Json Serialization in C#

c#, json, serialization

Solution

You could use the JavaScriptSerializer.

http://msdn.microsoft.com/en-us/library/system.web.script.serialization.javascriptserializer.aspx

var thing = new Thing();
var json = new JavaScriptSerializer().Serialize(thing);

Problem

I'm trying to serialize a local object to json but msdn documentation always seems to confuse me. I believe I am suppose to use the DataContractJsonSerializer but not completely sure, as I have seen mixed responses. I've also had someone recommend Newtonsoft. Does anyone have any experience with this that can point me in the right direction?

Original source