I want to serialize a dynamic object in JSON. I tried using ExpandoObject, but the result is not what I need:
public JsonResult Edit() { dynamic o = new ExpandoObject(); ((IDictionary<string,Object>)o)["abc"] = "ABC";
I want JSON to look like this: {"abc": "ABC"}, but instead it looks like {{"Key": "abc", "Value": "ABC"}] Obviously, ExpandoObject will not do, but can I inherit from DynamicObject and somehow override its methods to get the JSON format I want?
json c # serialization asp.net-mvc
panpawel Aug 12 2018-11-12T00: 00Z
source share