标签:des os ar for strong c on r line
string json=“[{“name”:”zhangsan”,”age”:”12”},{“name”:”zhangsan”,”age”:”12”}]”
方法1:
JArray arr = (JArray)JsonConvert.DeserializeObject(json);
JObject obj = (JObject)arr[1];
Console.WriteLine(obj["name"]);
Console.WriteLine(arr[1]["name"]);
方法2
一个对象
public class Student
{
}
List<Student> students = JsonConvert.DeserializeObject<List<Student>>(json);
foreach (Student model in students)
{
//dosomething
}
标签:des os ar for strong c on r line
原文地址:http://www.cnblogs.com/umlzhang/p/4011845.html