C#将对象序列化成JSON字符串 public string GetJsonString() { List<Product> products = new List<Product>(){ new Product(){Name="苹果",Price=5.5}, new Product(){Name="橘子",Price=2.5}, new Product(){Name="干柿子",Price=16.00} }; Produ…
命名空间 using Newtonsoft.Json.Linq; JObject obj = JObject.Parse("json字符串");用 obj[""]读取 1.序列化 public static string JsonSerializer<T>(T t) { DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(T)); MemoryStream ms =…