C# Json 序列化和反序列化 工具类 Newtonsoft.Json.dll
2013-09-03 11:38
931 查看
引用: Newtonsoft.Json.dll
// 引用: using Newtonsoft.Json; using Newtonsoft.Json.Converters;
// 定义 实体测试类 public class Customer { public string name { get; set; } public string code { get; set; } public Customer() // 貌似空构造函数必须 { } public Customer(string name, string code) { this.name = name; this.code = code; } }
List<Customer> cusList = new List<Customer>(); cusList.Add(new Customer("tom", "001")); cusList.Add(new Customer("Jack", "002")); cusList.Add(new Customer("Jerry", "003")); string jsonStr = JavaScriptConvert.SerializeObject(cusList); //序列化成 Json 格式 txt_RtnJson.Text = jsonStr; List<Customer> cusList2 = JavaScriptConvert.DeserializeObject<List<Customer>>(txt_fetchXml.Text); // 将 Json 字符串.反序列化成 实体类对象集
相关文章推荐
- C#.NET序列化XML、JSON、二进制微软自带DLL与newtonsoft(json.net)
- .Net使用Newtonsoft.Json.dll(JSON.NET)对象序列化成json、反序列化json示例教程
- C# .NET利用Newtonsoft.Json来序列化和反序列化对象
- .Net使用Newtonsoft.Json.dll(JSON.NET)对象序列化成json、反序列化json示例教程
- 使用NewtonSoft.JSON.dll来序列化和反序列化对象
- C# Json序列化和反序列化辅助类(官方DLL)
- c# 使用 Newtonsoft.Json 序列化json字符串以及,反序列化对象
- C# dynamic类型序列化和反序列化之Newtonsoft.Json
- 使用NewtonSoft.JSON.dll来序列化和发序列化对象
- C# Json序列化和反序列化
- Newtonsoft.Json 序列化和反序列化 时间格式
- Json工具类--使用Gson实现了Json的序列化和反序列化
- C#通用Json格式序列化和反序列化的方法
- C# Json序列化工具--Newtonsoft.Json简介和使用
- C# 使用Newtonsoft.Json序列化自定义类型
- Json序列化和反序列化(Newtonsoft)& 嵌套反序列化
- c# 动态调用Newtonsoft.Json.dll的类
- 使用NewtonSoft.JSON.dll来序列化和发序列化对象
- C#实现json的序列化和反序列化
- C#中JSON序列化和反序列化