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

 

posted @ 2013-01-22 11:51  云中雀  阅读(192)  评论(0编辑  收藏  举报