处理HTTPRequest.responseText的智能方法

时间:2012-05-02 09:56:24

标签: javascript facebook httprequest

我是HTTPRequests的新手,现在我有一个问题。我收到了这样的responseText:

{
"data":[ 

  {
     "id": "XXX1",
     "from": {
        "name": "name",
        "id": "YYYY"
     },
     "subject": "SecondTitle",
     "message": "Content - Second Note",
     "icon": "https://s-static.ak.facebook.com/rsrc.php/v1/yY/r/1gBp2bDGEuh.gif",
     "created_time": "2012-05-02T09:25:24+0000",
     "updated_time": "2012-05-02T09:25:24+0000"
  },
  {
     "id": "XXX2",
     "from": {
        "name": "name",
        "id": "YYYY"
     },
     "subject": "FirstTitle",
     "message": "Content - First Note",
     "icon": "https://s-static.ak.facebook.com/rsrc.php/v1/yY/r/1gBp2bDGEuh.gif",
     "created_time": "2012-05-01T20:40:16+0000",
     "updated_time": "2012-05-01T20:40:16+0000"
  }
 ],
"paging": {
  "previous": "https://graph.facebook.com/XXX/notes?access_token=ACCESS_TOKEN]&limit=25&since=1335950724&__previous=1", 
  "next": "https://graph.facebook.com/XXX/notes?access_token=[ACCESS_TOKEN]&limit=25&until=1335904815"
   }
}

我要做的是获得一个看起来像这样的多维数组:

Array[0][0] = "SecondTitle"
Array[0][1] = "Content - Second Note"
Array[0][2] = "2012-05-02T09:25:24+0000" (created_time)
Array[1][0] = "FirstTitle"
Array[1][1] = "Content - First Note"
Array[1][2] = "2012-05-01T20:40:16+0000"

有一种聪明的方法吗?或者我必须使用字符串操作?

0 个答案:

没有答案