我正在使用Newtonsoft Json库来解析json,但我不知道如何使用它。我使用JObject解析了字符串。当我在即时窗口中输出JObject实例的值时,我得到: -
json
{
"data": [
{
"id": "id",
"from": {
"name": "name",
"id": "someotherid"
},
"name": "pic",
"description": "desc",
"link": "linktosite",
"privacy": "everyone",
"count": 1,
"type": "normal",
"created_time": "2010-10-22T14:54:32+0000",
"updated_time": "2010-10-22T14:55:41+0000"
},
{
"id": "id2",
"from": {
"name": "name",
"id": "someotherid"
},
"name": "Profile Pictures",
"link": "link",
"privacy": "everyone",
"count": 6,
"type": "profile",
"created_time": "2010-10-12T14:27:58+0000",
"updated_time": "2011-01-01T18:38:14+0000"
},
{
"id": "id3",
"from": {
"name": "name",
"id": "829741958"
},
"name": "T",
"link": "link",
"privacy": "everyone",
"count": 5,
"type": "normal",
"created_time": "2010-05-01T03:03:39+0000",
"updated_time": "2010-05-01T03:19:13+0000",
"comments": {
"data": [
{
"id": "id",
"from": null,
"message": "message",
"created_time": "2010-08-28T18:27:10+0000",
"likes": 1
}
]
}
}
],
"paging": {
"previous": "paginglink",
"next": "otherpaginglink"
}
}
Count: 2
Type: Object
我应该如何进一步获取此作业的值?
答案 0 :(得分:3)
我个人更喜欢JavaScriptSerializer在.NET环境中与JSON一起使用。默认情况下,它将返回Dictionary结果,但可用于解析自定义对象(或者您可以使用动态数据类型)。
Some other posts on SO with JSON & JavaScript Serializer as topic
答案 1 :(得分:1)
我在以前的查询中找到了相同主题的答案: