Author: einarq | Posted on: 6/26/2008 8:47:01 AM | Views : 488

Not sure where to post this. For me this is an architecture related issue, so I'll try here.

In .NET 3.5, the very handy JavaScriptSerializer has been marked as Obsolote, and replaced with the DataContractSerializer. However, I don't believe "replaced" is a correct term for this, since the behavior is drastically changed.
Using the JavaScriptSerializer, you can serialize any object to JSON, and it works beatifully.
Using the DataContractJsonSerializer you need to specify the DataMember attribute on each property you wish to be serialized. This is of course possible as long as you only serialize classes that have you have written yourself, but does not work if you wish to serialize an object created by a third party.

Another very interesting issue related to this is that Microsoft must be using the JavaScriptSerializer in their own code since ScriptServices can actually still serialize any object to JSON, without requiring the DataMember at ...

Go to the complete details ...