Newtonsoft.json is a Json format processing class library for. NET open source
Official website: http://json.codeplex.com/
The Newtonsoft.json library is referenced in the project being used. Commonly used methods have serialization and deserialization methods
1 Serialization: Serializing an object into a JSON-formatted string
V_bbstopic_user entity = db. gettentity<v_bbstopic_user>(SQL); if NULL { string json = jsonconvert.serializeobject (entity); Serializes the context. Response.Write (JSON); }
2 deserialization: Converts a string of josn format into an entity object. For example
Public class A { publicstringgetset;} Public Get Set ; } } Deserialization string json="{' ID ': ' 1 ', ' createdate ': ' 2014-08-20 '}" = jsonconvert.deserializeobject< a> (JSON);
3 Newtonsoft.json Other methods
// JSON cannot be an array string " {' A ': ' AAA ', ' B ': ' BBB ', ' C ': ' CCC '} " = jobject.parse (JSONTEXT2); Console.WriteLine ("A:"+jobj["a"]); Console.read ();