将json字符串转成Json对象,获取对应的属性值

// oldtext 是json字符串
List<object> jb = JsonConvert.DeserializeObject<List<object>>(oldtext); //方法一: foreach (JObject item in jb) { foreach (var itm in item.Properties()) { Console.WriteLine(itm.Name); Console.WriteLine(itm.Value); } } //方法二: JArray json = JArray.Parse(oldtext); foreach (JObject items in json) { foreach (var item in items) { Console.WriteLine(item.Key); Console.WriteLine(item.Value); } }