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
上一篇:Spring MVC学习总结(8)——Swagger入门详解


下一篇:spring MVC学习之二