首页 新闻 搜索 专区 学院

复杂Json格式转换为C#对象问题

0
悬赏园豆:10 解决于 2013-03-29 17:00
[{"data":[{"column":"UserName","sortcolmn":"DESC"},{"column":"UserID","sortcolmn":"ASC"}],"name":"sort"},{"data":[{"column":"UserName","operat":"=","value":"admin","type":"and"}],"name":"where"}]

json对象如上,C#类定义如下

    public class Model<T>
    {
        public string name { get; set; }
        public List<T> data;
    }

    //排序
    public class sort
    {
        public string column { get; set; }
        public string sortcolmn { get; set; }
    }
    //筛选条件
    public class where
    {
        public string column { get; set; }
        public string operat { get; set; }
        public string value { get; set; }
        public string type { get; set; }
    }

    //表关联
    public class join
    {
        public string jointype { get; set; }
        public string column1 { get; set; }
        public string colunm2 { get; set; }
    }

    /// <summary>
    /// 分组条件
    /// </summary>
    public class group
    {
        public string column { get; set; }
    }
    /// <summary>
    /// 分组过率条件
    /// </summary>
    public class having
    {
        public string column { get; set; }
        public string operat { get; set; }
        public string value { get; set; }
        public string type { get; set; }
    }
    /// <summary>
    /// 显示的列
    /// </summary>
    public class column
    {
        public List<string> Column { get; set; }
    }

用的是Newtonsoft.Json,请教不管用何种插件,还是.net本身对象,把字符串转换为C#对象即可

不能迷糊的主页 不能迷糊 | 初学一级 | 园豆:158
提问于:2013-03-23 18:36
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册