C#读取json数据介绍

//using System.Web.Script.Serialization;

JavaScriptSerializer serializer = new JavaScriptSerializer();
Dictionary<string, object> json = (Dictionary<string, object>)serializer.DeserializeObject(
"{name: 'zswang', forum: 'c#'}");
object value;
if (json.TryGetValue("name", out value))

 string value2 = json.Where(t => t.Key == "access_token").FirstOrDefault().Value;
Console.WriteLine(value); // 输出:zswang


posted @ 2016-05-24 21:09  jimcsharp  阅读(3137)  评论(0编辑  收藏  举报