json反序列化回来空了

时间:2011-08-09 20:48:38

标签: visual-studio-2010 json.net

我从这里接受了建议并试图创建一个包含对象的类,我需要从json feed中解析这些部分。然后我尝试在将字段内容映射到我的对象之前反序列化它,但反序列化不返回任何内容。

以下是json Feed内容:

 "data": [
  {
     "id": "17xxxxxxxxxxxxx_xxxxxxxxxxxxxxxxxxx",
     "from": {
        "name": "Lxxxxxx",
        "category": "Sports league",
        "id": "17xxxxxxxxxxxxx"
     },
     "picture": "http://external.ak.fbcdn.net/safe_image.php?d=AQB4GscSy-2RHY_0&w=130&h=130&url=http\u00253A\u00252F\u00252Fwww.ligabbva.com\u00252Fquiz\u00252Farchivos\u00252Fbenzema-quiz-facebook.png",
     "link": "http://www.xxxxxva.com/quiz/index.php?qid=34",
     "source": "http://www.lxxxxva.com/modulos/redirectQuiz.php?name=benzema&q=34&time=1312827103",
     "name": "DEMUESTRA CU\u00c1NTO SABES SOBRE... BENZEMA",
     "caption": "www.xxxxxva.com",
     "description": "Demuestra cu\u00e1nto sabes sobre Karim Benzema, delantero del Real Madrid.",
     "icon": "http://static.ak.fbcdn.net/rsrc.php/v1/yj/r/v2OnaTyTQZE.gif",
     "type": "video",
     "created_time": "2011-08-08T18:11:54+0000",
     "updated_time": "2011-08-08T18:11:54+0000",
     "likes": {
        "data": [
           {
              "name": "Jhona Arancibia",
              "id": "100000851276736"
           },
           {
              "name": "Luis To\u00f1o",
              "id": "100000735350531"
           },
           {
              "name": "Manuel Raul Guerrero Cumbicos",
              "id": "100001485973224"
           },
           {
              "name": "Emmanuel Gutierrez",
              "id": "100000995038988"
           }
        ],
        "count": 127
     },
     "comments": {
        "count": 33
     }
  },
  {
     "id": "17xxxxxxxxxxxxxxxx_xxxxxxxxxxxxx",
     "from": {
        "name"

这是我正在尝试的代码。我也尝试使用jsontextreader并遍历每个tokentype并检查每个tokentype,然后读取值,但这看起来会变得乏味。

....
 //fetch the content
 responsedata = reader.readtoend()
 ......
dim pp as facedata = JsonConvert.DeserializeObject(of faceData)(responsedata)
console.writeline(pp.id.tostring)

和类对象

  Public Class faceData
   Public Property id() as string 
      Get
           Return f_id
      End Get
      Set(ByVal value as string)
           f_id =value
      End Set
   End Property
   Private f_id as string 

   ......

任何回复表示赞赏。

是否有人使用vb.net链接到完整代码。

0 个答案:

没有答案