.net object对象操作json数组,并且获取object对象中数组所对应的值
using Newtonsoft.Json;
string jsonstr = "[{\"id\":1,\"name\":\"张三\"},{\"id\":2,\"name\":\"李四\"}]";
List<object> sg = new List<object>();
var json = JsonConvert.DeserializeAnonymousType(jsonstr, sg); //序列化数组对象
for (int i = 0; i < json.Count(); i++)//循环数组对象
{
JavaScriptSerializer serializer = new JavaScriptSerializer();
Dictionary<string, object> jsonpk = (Dictionary<string, object>)serializer.DeserializeObject(json[i].ToString());//序列化成键值对
object value = "";//用来接收获取的对象值
jsonpk.TryGetValue("name", out value);
}