Method One:
Assembly: System.Web.Extensions;
namespaces: System.Web.Script.Serialization;
The most important class: JavaScriptSerializer
Instantiation of
JavaScriptSerializer js = new JavaScriptSerializer ();
Js. Serialize ();//Convert object to JSON string; serial number
Js. Deserialize ();//convert JSON strings to objects; deserialize
Method Two:
Assembly: Newtonsoft.Json.dll;
namespaces: Newtonsoft.json;
Important classes: JsonConvert; 4.0 version and above
Jsonconvert.serializeobject ();
Jsonconvert.deserializeobject ();
Important classes: javascriptconvert;4.0 the following versions
Javascriptconvert.serializeobject ();
Javascriptconvert.deserializeobject ();
Method Three:
Assembly: Newtonsoft.Json.Compact.dll;
namespaces: Newtonsoft.json; Version 4.0 and above
Important classes: jsonconvert;4.0 the following versions
Jsonconvert.serializeobject ();
Jsonconvert.deserializeobject ();
Small warning: Javascriptconvert.serializeobject is present in the 1.3.X version
If the new version of Json.NET, such as Json.NET 4.0, has been moved under the Newtonsoft.Json.JsonConvert class.
Newtonsoft.Json.JsonConvert.DeserializeObject
Newtonsoft.Json.JsonConvert.SerializeObject
So if you can't find the Javascriptconvert class, it's your version of the problem, please try to download other versions of json.net;
JSON transformation xml:
Assembly: System.Runtime.Serialization.dll;
namespaces: System.Runtime.Serialization.Json;
Important classes: DataContractJsonSerializer;
Important class: Xmlobjectserializer//provides a base class for serializing an object into an XML stream or document