日期:2014-05-17  浏览次数:20758 次

如何解析json数据?
登陆成功后网页会返回如下数据:
[2012-12-26 11:13:21] EMAIL: 309066557@qq.com PASSWORD: e2ac3eceab2902e67026203c513f5533 {"title":1,"userid":1734,"list":[{"s_id":"3"}],"tokenlist":[{"s_id":"3","token":"173899|6.80b926c2778fc1aea416c90e800b8623.2592000.1348992000-261351411","token_secret":"173899|0.ny8z8q4KgpkzST3J5xw4kA5kRr2R230l.261351411","u_id":"261351411"}],"silencetime":{"start_time":"09:00","end_time":"22:00"},"version":10}
我想用json.net来解析,但是返回数据的json串中含有数组,该如何构造匹配类呢?
------解决方案--------------------
去下载 Newtonsoft.Json.dll
------解决方案--------------------
http://bbs.csdn.net/topics/390329122
------解决方案--------------------

public class Json
{
    public string title
    {
        get;set;
    }
    public string userid
    {
        get;set;
    }
    public List<Item> list
    {
        get;set;
    }
    public List<TokenItem> tokenlist
    {
        get;set;
    }
    public SilenceTime silencetime
    {
        get;set;
    }
    public int version
    {
        get;set;
    }        
}
public class Item
{
    public string s_id
    {
        get;set;
    }
}
public class TokenItem
{
    public string s_id
    {
        get;set;
    }
    public string token
    {
        get;set;
    }
    public string token_secret
    {
        get;set;
    }
    public string u_id
    {
        get;set;
    }
}
public class SilenceTime
{
    public string start_time
    {
        get;set;
    }
    public string end_time
    {
        get;set;
    }
}