首页 新闻 会员 周边 捐助

像这样的混合JSON该如何反序列化为实体?

0
悬赏园豆:50 [已解决问题] 解决于 2013-08-31 23:08

{

    "message": "成功",

    "data": {

        "limit": 0,

        "total": 800,

        "start": 20,

        "list": [

            {

                "id": 2405523769,

                "messageId": 775101403,

                "Create": 1375905233000,

                "Modified": 1375928731000,

                "Type": 1,

                "targetId": 585283801,

                "replyStatus": 0

            },

            {

                "id": 2404981245,

                "messageId": 774684997,

                "Create": 1375752377000,

                "Modified": 1375753577000,

                "Type": 5,

                "targetId": 211093954,

                "replyStatus": 1

            },

            {

                "id": 2404977668,

                "messageId": 774683839,

                "Create": 1375751344000,

                "Modified": 1375753576000,

                "Type": 5,

                "targetId": 211093954,

                "replyStatus": 1

            },

            {

                "id": 2404965686,

                "messageId": 5591387666,

                "Create": 1375746558000,

                "Modified": 1375771535000,

                "Type": 1,

                "targetId": 1103045089,

                "replyStatus": 0

            },

            {

                "id": 2404807912,

                "messageId": 774551142,

                "Create": 1375700412000,

                "Modified": 1375750904000,

                "Type": 5,

                "targetId": 211093954,

                "replyStatus": 1

            },

            {

                "id": 2404670958,

                "messageId": 774457043,

                "Create": 1375666474000,

                "Modified": 1375690013000,

                "Type": 5,

                "targetId": 211093954,

                "replyStatus": 1

            },

            {

                "id": 2404665403,

                "messageId": 774448434,

                "Create": 1375664269000,

                "Modified": 1375690014000,

                "Type": 5,

                "targetId": 211093954,

                "replyStatus": 1

            },

            {

                "id": 2404661178,

                "messageId": 774446607,

                "Create": 1375662580000,

                "Modified": 1375667457000,

                "Type": 1,

                "targetId": 211093954,

                "replyStatus": 1

            }

        ]

    },

    "statuscode": 200,

    "filter":false,

    "isNull": false

}

Hawker的主页 Hawker | 初学一级 | 园豆:159
提问于:2013-08-31 03:24
< >
分享
最佳答案
0

JavaScriptSerializer 

你建一个和json一模一样的对象就可以deserialize了,非常好用。

收获园豆:10
小AI | 菜鸟二级 |园豆:354 | 2013-08-31 17:46
其他回答(5)
0

什么意思?

陈希章 | 园豆:2538 (老鸟四级) | 2013-08-31 06:43

像这样的混合JSON该如何反序列化为实体? 

标题写错了,已经更改,想请教如何反序列化JSON字符串为实体

支持(0) 反对(0) Hawker | 园豆:159 (初学一级) | 2013-08-31 07:47
0

http://stackoverflow.com/questions/10741374/json-net-json-to-entity

收获园豆:10
Yu | 园豆:12990 (专家六级) | 2013-08-31 08:26
0

嵌套类就可以了~~~

收获园豆:10
幻天芒 | 园豆:37207 (高人七级) | 2013-08-31 09:38

注意补全[],

支持(0) 反对(0) 幻天芒 | 园豆:37207 (高人七级) | 2013-08-31 09:45
0

实体是如何定义的?

收获园豆:20
dudu | 园豆:30585 (高人七级) | 2013-08-31 16:12

就是不知道要定义什么样的实体才能使用JSON.NET反序列化,我现在是用JSON.NET分步做的,按层次定义了3个实体,obj,data,list,obj包含data,data包含list集合

支持(0) 反对(0) Hawker | 园豆:159 (初学一级) | 2013-08-31 16:41

@Hawker: 那可以不用实体,用JSON.NET的jObject搞定,参考:Json的序列化问题

支持(0) 反对(0) dudu | 园豆:30585 (高人七级) | 2013-08-31 16:44
0

json字符串转实体类的,可以用这个工具:http://www.ofmonkey.com/

独孤飞 | 园豆:283 (菜鸟二级) | 2017-01-16 16:43
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册