• 企业400电话
  • 微网小程序
  • AI电话机器人
  • 电商代运营
  • 全 部 栏 目

    企业400电话 网络优化推广 AI电话机器人 呼叫中心 网站建设 商标✡知产 微网小程序 电商运营 彩铃•短信 增值拓展业务
    Json数据转换list对象实现思路及代码
    JSON代码
    复制代码 代码如下:

    [{"cId":2,"cName":"\u767d\u841d\u535c","amount":26,"price":"17"},{"cId":3,"cName":"\u80e1\u841d\u535c","amount":21,"price":"21"},{"cId":4,"cName":"\u7389\u7c73","amount":7,"price":"23"},{"cId":14,"cName":"\u897f\u74dc","amount":7,"price":"29"},{"cId":5,"cName":"\u571f\u8c46","amount":3,"price":"24"},{"cId":1,"cName":"\u8349\u8393","amount":427,"price":"27"},{"cId":10,"cName":"\u5357\u74dc","amount":303,"price":"30"},{"cId":11,"cName":"\u82f9\u679c","amount":1,"price":"24"},{"cId":23,"cName":"\u77f3\u69b4","amount":4,"price":"54"},{"cId":18,"cName":"\u6843\u5b50","amount":3,"price":"40"},{"cId":15,"cName":"\u9999\u8549","amount":9,"price":"32"},{"cId":13,"cName":"\u8461\u8404","amount":7,"price":"47"},{"cId":26,"cName":"\u67da\u5b50","amount":1,"price":"58"},{"cId":27,"cName":"\u83e0\u841d","amount":5,"price":"62"},{"cId":19,"cName":"\u6a59\u5b50","amount":27,"price":"41"}]

    VS2008
    引用System.ServiceModel.Web.dll
    引用System.Runtime.Serialization.dll
    复制代码 代码如下:

    private void Form1_Load(object sender, EventArgs e)
    {
    string _JsonText = System.IO.File.ReadAllText(@"C:\2.TXT");
    ListTest> _Test = new ListTest>();
    DataContractJsonSerializer _Json = new DataContractJsonSerializer(_Test.GetType());
    byte[] _Using = System.Text.Encoding.UTF8.GetBytes(_JsonText);
    System.IO.MemoryStream _MemoryStream = new System.IO.MemoryStream(_Using);
    _MemoryStream.Position = 0;
    _Test =(ListTest>)_Json.ReadObject(_MemoryStream);
    }
    public class Test
    {
    public int cId = 0;
    public string cName = "";
    public int amount = 0;
    public string price = "";
    }
    您可能感兴趣的文章:
    • Java JSON转成List结构数据
    • python使用zip将list转为json的方法
    • Json字符串与Object、List、Map的互转工具类
    • JSON--List集合转换成JSON对象详解
    • 将List对象列表转换成JSON格式的类实现方法
    • 将Java的List结构通过GSON库转换为JSON的方法示例
    • JSON的String字符串与Java的List列表对象的相互转换
    • Json转list二层解析转换代码实例
    上一篇:ASP.NET笔记之 Httphandler的操作详解
    下一篇:关于.NET的集合总结
  • 相关文章
  • 

    © 2016-2020 巨人网络通讯 版权所有

    《增值电信业务经营许可证》 苏ICP备15040257号-8

    Json数据转换list对象实现思路及代码 Json,数据,转换,list,对象,