援类库:Newtonsoft.Json

序列化原型:string json = JavaScriptConvert.SerializeObject(object
value);  

List<Student> lists =new List<Student>(); 
lists.Add(new Student{ ID=1, Name="Sword", Age=26});         
String str = JavaScriptConvert.SerializeObject(lists);

反序列化原型: object obj = JavaScriptConvert.DeserializeObject(string
str, Type type)

 var list = JavaScriptConvert.DeserializeObject(str, typeof(List<Student>)) as List<Student>;

  

   

相关文章

网站地图xml地图