• json.net 反序列化


     

    string str =“[{"nick":"xizikr","date":"2012-07-01","campaignid":6820402,"adgroupid":109403796,"keywordid":14521166681,"source":1,"directpay":0,"indirectpay":0,"directpaycount":0,"indirectpaycount":0,"favitemcount":0,"favshopcount":0,"keywordstr":"雪纺短袖上衣 夏","searchtype":"SEARCH"},{"nick":"xizikr","date":"2012-07-01","campaignid":6820402,"adgroupid":109403796,"keywordid":14458147193,"source":2,"directpay":0,"indirectpay":0,"directpaycount":0,"indirectpaycount":0,"favitemcount":0,"favshopcount":0,"keywordstr":"白色雪纺衫","searchtype":"SEARCH"},{"nick":"xizikr","date":"2012-07-02","campaignid":6820402,"adgroupid":109403796,"keywordid":14458268959,"source":1,"directpay":0,"indirectpay":0,"directpaycount":0,"indirectpaycount":0,"favitemcount":0,"favshopcount":0,"keywordstr":"泡泡袖雪纺衫","searchtype":"SEARCH"},{"nick":"xizikr","date":"2012-07-02","campaignid":6820402,"adgroupid":109403796,"keywordid":14458147189,"source":2,"directpay":0,"indirectpay":0,"directpaycount":0,"indirectpaycount":0,"favitemcount":0,"favshopcount":0,"keywordstr":"雪纺衫上衣夏装短袖","searchtype":"SEARCH"},{"nick":"xizikr","date":"2012-07-02","campaignid":6820402,"adgroupid":109403796,"keywordid":14521193780,"source":2,"directpay":0,"indirectpay":0,"directpaycount":0,"indirectpaycount":0,"favitemcount":0,"favshopcount":0,"keywordstr":"雪纺衬衫","searchtype":"SEARCH"},{"nick":"xizikr","date":"2012-07-02","campaignid":6820402,"adgroupid":109403796,"keywordid":13498856537,"source":1,"directpay":0,"indirectpay":0,"directpaycount":0,"indirectpaycount":0,"favitemcount":0,"favshopcount":0,"keywordstr":"荷叶边 雪纺上衣","searchtype":"SEARCH"},{"nick":"xizikr","date":"2012-07-02","campaignid":6820402,"adgroupid":109403796,"keywordid":14521166681,"source":1,"directpay":0,"indirectpay":0,"directpaycount":0,"indirectpaycount":0,"favitemcount":0,"favshopcount":0,"keywordstr":"雪纺短袖上衣 夏","searchtype":"SEARCH"},{"nick":"xizikr","date":"2012-07-03","campaignid":6820402,"adgroupid":109403796,"keywordid":14458147189,"source":2,"directpay":0,"indirectpay":0,"directpaycount":0,"indirectpaycount":0,"favitemcount":0,"favshopcount":0,"keywordstr":"雪纺衫上衣夏装短袖","searchtype":"SEARCH"},{"nick":"xizikr","date":"2012-07-03","campaignid":6820402,"adgroupid":109403796,"keywordid":14458019365,"source":2,"directpay":0,"indirectpay":0,"directpaycount":0,"indirectpaycount":0,"favitemcount":0,"favshopcount":0,"keywordstr":"白色雪纺t恤","searchtype":"SEARCH"},{"nick":"xizikr","date":"2012-07-03","campaignid":6820402,"adgroupid":109403796,"keywordid":14458226918,"source":1,"directpay":0,"indirectpay":0,"directpaycount":0,"indirectpaycount":0,"favitemcount":0,"favshopcount":0,"keywordstr":"上衣 女 夏","searchtype":"SEARCH"},{"nick":"xizikr","date":"2012-07-03","campaignid":6820402,"adgroupid":109403796,"keywordid":14458174238,"source":1,"directpay":0,"indirectpay":0,"directpaycount":0,"indirectpaycount":0,"favitemcount":0,"favshopcount":0,"keywordstr":"雪纺短袖上衣","searchtype":"SEARCH"}]”;
    List<keywordeffec> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<keywordeffec>>(str);
               
                foreach (keywordeffec item in list)
                {
                    Response.Write(item.keywordstr+"<br/>");
                }
    
    public class keywordeffec
    {
        public string nick { get; set; }
        public long campaignid { get; set; }
        public long adgroupid { get; set; }
        public string keywordid { get; set; }
        public string source { get; set; }
        public string indirectpay { get; set; }
        public string directpaycount { get; set; }
        public string indirectpaycount { get; set; }
        public string favitemcount { get; set; }
        public string favshopcount { get; set; }
        public string keywordstr { get; set; }
        public string searchtype { get; set; }
    }
    

     

    转自: http://www.cnblogs.com/tianzhenlanglang/archive/2012/07/04/2576071.html

     

  • 相关阅读:
    在SQL使用正则表达式
    What is callback?
    readResolve()的使用
    What is a serialVersionUID and why should I use it?
    How to terminate a thread in Java
    Eclipse导入源文件出现编码的问题
    What is livelock?
    [转]不要迷失在技术的海洋中
    [转]基于.Net的单点登录(SSO)解决方案
    IIS网站真正301重定向的方法(包括首页和内页)
  • 原文地址:https://www.cnblogs.com/blosaa/p/2871110.html
Copyright © 2020-2023  润新知