2011-02-08 79 views
3

我使用Newtonsoft Json庫來解析json,但我不知道如何使用它。我使用JObject解析了字符串。當我在輸出即時窗口JObject實例的值,我得到這樣的: -我如何解析json?

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 

是我應該做進一步有從這個jobject值是多少?

+3

大概你會通過給出的索引來訪問它的元素。 – 2011-02-08 04:05:37

+0

看看這有助於:http://stackoverflow.com/questions/3848162/json-parsing-with-newtonsoft-json – 2011-02-08 04:09:50

回答