Any way to make DataContractJsonSerializer serialize Dictionaries properly?
- by morpheus
The DataContractJsonSerializer is not able to serialize Dictionaries properly.
Whereas JavaScriptSerializer serializes Dictionaries as {"abc":"xyz","def":42}
for example,
the DataContractJsonSerializer gives [{"Key":"abc","Value":"xyz"},{"Key":"def","Value":42}] instead.
This is really problematic and I want to know how can I serialize Dictionary objects correctly in my WCF service. I am looking for a solution that would require least amount of effort.
ref: http://msdn.microsoft.com/en-us/library/bb412170.aspx