标签:
#region JavaScriptSerializer
//这是一种C#自带的序列化的方式
//JavaScriptSerializer Serializer = new JavaScriptSerializer();
//List<Product> objs = Serializer.Deserialize<List<Product>>(name);
#endregion
#region JsonConvert
//使用第三方
//List<Product> jobInfoList = JsonConvert.DeserializeObject<List<Product>>(name);
#endregion
//用数组来接受 然后把数组转成对象
JArray javascript = (JArray)JsonConvert.DeserializeObject(name);
List<string> list = new List<string>();
for (int i = 0; i < javascript.Count; i++)
{
JObject obj = (JObject)javascript[i];
string outValue = obj["Name"].ToString(); //将一个个反序列化的JSON字符串数组转换成对象
list.Add(outValue);
}
标签:
原文地址:http://www.cnblogs.com/xiaojian1/p/5544399.html