Any way to make DataContractJsonSerializer serialize Dictionaries properly?

Posted by morpheus on Stack Overflow See other posts from Stack Overflow or by morpheus
Published on 2010-12-30T04:24:17Z Indexed on 2010/12/30 4:54 UTC
Read the original article Hit count: 226

Filed under:

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

© Stack Overflow or respective owner

Related posts about wcf