//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
时间: 2024-10-23 02:13:16