I have an [DataContract] object that has some properties and is serialized to JSON using DataContractJsonSerializer.
One of the properties is of type Dictionary<string, string> and when the serialization happens it produces the following JSON schema.
"extra_data": [
{
"Key": "aKey",
"Value": "aValue"
}
]
Now I need the JSON schema to be like this
"extra_data": {
"aKey": "aValue"
}
You can never of course know before what the values are, it is a Dictionary that the user will set keys and values.
I'm thinking if this can happen using anonymous types, or is there a configuration I can take to accomplish my goal?
Thank you.