码迷,mamicode.com
首页 > Web开发 > 详细

Newtonsoft.Json 序列化反序列化

时间:2015-05-04 17:20:19      阅读:110      评论:0      收藏:0      [点我收藏+]

标签:

public class People
{
public string name { get; set; }
public string age { get; set; }
public string sex { get; set; }
}
List<People> list = new List<People>();
list.Add(new People { name = "Jane", age = "18", sex = "female" });
list.Add(new People { name = "Lucy", age = "21", sex = "female" });
list.Add(new People { name = "Anne", age = "20", sex = "female" });

string str = JsonConvert.SerializeObject(list);//序列化
List<People> peopleList = JsonConvert.DeserializeObject<List<People>>(str);//反序列化

Newtonsoft.Json 序列化反序列化

标签:

原文地址:http://www.cnblogs.com/JohnnyBao/p/4476427.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!