请求 多层json怎么定义类反序列? json cjson类反序列 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 你的 Customer 中定义的 successed 去哪儿了? 楼主的JSON数据错误,数组data少了一个 ] ,否则可以试试fastCSharp public class Customer { public bool successed { get; set; } public hotvalue value { get; set; } } public class hotvalue { public hotdata[] data { get; set; } public int total { get; set; } } public class hotdata { public string company_cnt { get; set; } public string keywords { get; set; } public string showwin_cnt { get; set; } public string srh_pv_last_10mon { get; set; } public string srh_pv_last_11mon { get; set; } public string srh_pv_last_1mon { get; set; } public string srh_pv_last_2mon { get; set; } public string srh_pv_last_3mon { get; set; } public string srh_pv_last_4mon { get; set; } public string srh_pv_last_5mon { get; set; } public string srh_pv_last_6mon { get; set; } public string srh_pv_last_7mon { get; set; } public string srh_pv_last_8mon { get; set; } public string srh_pv_last_9mon { get; set; } public string srh_pv_this_mon { get; set; } } string json = @"{""successed"":true,""value"":{""data"":[{""company_cnt"":""1143"",""keywords"":""kitchen cabinet"",""showwin_cnt"":""298"",""srh_pv_last_10mon"":""13000"",""srh_pv_last_11mon"":""13000"",""srh_pv_last_1mon"":""17000"",""srh_pv_last_2mon"":""16000"",""srh_pv_last_3mon"":""17000"",""srh_pv_last_4mon"":""14000"",""srh_pv_last_5mon"":""16000"",""srh_pv_last_6mon"":""13000"",""srh_pv_last_7mon"":""14000"",""srh_pv_last_8mon"":""18000"",""srh_pv_last_9mon"":""12000"",""srh_pv_this_mon"":""27000"",""yyyymm"":""201408""},{""company_cnt"":""2228"",""keywords"":""cabinet"",""showwin_cnt"":""251"",""srh_pv_last_10mon"":""4200"",""srh_pv_last_11mon"":""6000"",""srh_pv_last_1mon"":""12000"",""srh_pv_last_2mon"":""6000"",""srh_pv_last_3mon"":""4800"",""srh_pv_last_4mon"":""3100"",""srh_pv_last_5mon"":""4100"",""srh_pv_last_6mon"":""2400"",""srh_pv_last_7mon"":""3200"",""srh_pv_last_8mon"":""3300"",""srh_pv_last_9mon"":""3900"",""srh_pv_this_mon"":""13000"",""yyyymm"":""201408""}],""total"":1814}}"; Customer value = fastCSharp.setup.cSharp.json.parse.Get<Customer>(json); 我只是用result代替了success这个名字而已? 对的,是我复制少了一个“]”,难道用DataContractJsonSerializer就不能解析这个json吗? {"successed":true,"value":{"data":[{"company_cnt":"1143","keywords":"kitchen cabinet","showwin_cnt":"298","srh_pv_last_10mon":"13000","srh_pv_last_11mon":"13000","srh_pv_last_1mon":"17000","srh_pv_last_2mon":"16000","srh_pv_last_3mon":"17000","srh_pv_last_4mon":"14000","srh_pv_last_5mon":"16000","srh_pv_last_6mon":"13000","srh_pv_last_7mon":"14000","srh_pv_last_8mon":"18000","srh_pv_last_9mon":"12000","srh_pv_this_mon":"27000","yyyymm":"201408"},{"company_cnt":"2228","keywords":"cabinet","showwin_cnt":"251","srh_pv_last_10mon":"4200","srh_pv_last_11mon":"6000","srh_pv_last_1mon":"12000","srh_pv_last_2mon":"6000","srh_pv_last_3mon":"4800","srh_pv_last_4mon":"3100","srh_pv_last_5mon":"4100","srh_pv_last_6mon":"2400","srh_pv_last_7mon":"3200","srh_pv_last_8mon":"3300","srh_pv_last_9mon":"3900","srh_pv_this_mon":"13000","yyyymm":"201408"}],"total":1814}} 你发送的时候是bool successed,接收的时候是public string result两边的 public class Customer结构都不同,还想反序列化?? C#问题急!!! in,between,and,or,C#轻松自定义语法糖 求个算法 关于ArrayList的 关于Java程序和C#程序,数据同步问题 c# Dataset导出数据到excel的问题? UpdatePane刷新和Ajax控件Timer的问题 关于C#的基础题 一段数据检索代码? **************大量精品代码整理发布。。。。。。(不断收集中,顶着有分)******************* 今天面试遇到一神题,求解释 请教C#动态建模,类似visio界面编程 请问Dictionary在Schema文件中如何表示?
public class Customer
{
public bool successed { get; set; }
public hotvalue value { get; set; }
}
public class hotvalue
{
public hotdata[] data { get; set; }
public int total { get; set; }
}
public class hotdata
{
public string company_cnt { get; set; }
public string keywords { get; set; }
public string showwin_cnt { get; set; }
public string srh_pv_last_10mon { get; set; }
public string srh_pv_last_11mon { get; set; }
public string srh_pv_last_1mon { get; set; }
public string srh_pv_last_2mon { get; set; }
public string srh_pv_last_3mon { get; set; }
public string srh_pv_last_4mon { get; set; }
public string srh_pv_last_5mon { get; set; }
public string srh_pv_last_6mon { get; set; }
public string srh_pv_last_7mon { get; set; }
public string srh_pv_last_8mon { get; set; }
public string srh_pv_last_9mon { get; set; }
public string srh_pv_this_mon { get; set; }
} string json = @"{""successed"":true,""value"":{""data"":[{""company_cnt"":""1143"",""keywords"":""kitchen cabinet"",""showwin_cnt"":""298"",""srh_pv_last_10mon"":""13000"",""srh_pv_last_11mon"":""13000"",""srh_pv_last_1mon"":""17000"",""srh_pv_last_2mon"":""16000"",""srh_pv_last_3mon"":""17000"",""srh_pv_last_4mon"":""14000"",""srh_pv_last_5mon"":""16000"",""srh_pv_last_6mon"":""13000"",""srh_pv_last_7mon"":""14000"",""srh_pv_last_8mon"":""18000"",""srh_pv_last_9mon"":""12000"",""srh_pv_this_mon"":""27000"",""yyyymm"":""201408""},{""company_cnt"":""2228"",""keywords"":""cabinet"",""showwin_cnt"":""251"",""srh_pv_last_10mon"":""4200"",""srh_pv_last_11mon"":""6000"",""srh_pv_last_1mon"":""12000"",""srh_pv_last_2mon"":""6000"",""srh_pv_last_3mon"":""4800"",""srh_pv_last_4mon"":""3100"",""srh_pv_last_5mon"":""4100"",""srh_pv_last_6mon"":""2400"",""srh_pv_last_7mon"":""3200"",""srh_pv_last_8mon"":""3300"",""srh_pv_last_9mon"":""3900"",""srh_pv_this_mon"":""13000"",""yyyymm"":""201408""}],""total"":1814}}";
Customer value = fastCSharp.setup.cSharp.json.parse.Get<Customer>(json);
我只是用result代替了success这个名字而已?
对的,是我复制少了一个“]”,难道用DataContractJsonSerializer就不能解析这个json吗?
两边的 public class Customer结构都不同,还想反序列化??