1.JSON序列化
string JsonStr= JsonConvert.SerializeObject(Entity);
eg:
A a=new A();
a.Name="Elain00";
a.Hobby="eat eat";
string jsonStr=JsonConvert.SerializeObject(a);
2.JSON反序列化
string jsonstr =
"jsonString";
Class model =
JsonConvert.DeserializeObject<Class>(jsonstr);
eg:
string JsonStr=‘"{\‘Name\‘:\‘Elaine00\‘,\‘Hobby\‘:\‘eat eat\‘}";
A a=JsonConvert.DeserializeObject<A>(JsonStr);