2014-03-14 75 views
0

我想從下面的JSON中抽出變量?格式的響應使用javascript:用&符解析JSON數據?

{ 
    "result": { 
     "buffer": [84,73,77,69,83,84,65,77,80,61,50,48,49,52,37,50,100,48,51,37,50,100,49,51,84,50,48,37,51,97,48,56,37,51,97,53,54,90,38,67,79,82,82,69,76,65,84,73,79,78,73,68,61,52,101,100,50,49,48,52,57,53,101,57,54,50,38,65,67,75,61,83,117,99,99,101,115,115,38,86,69,82,83,73,79,78,61,57,51,38,66,85,73,76,68,61,49,48,48,51,48,49,53,56], 
     "cookies": {}, 
     "headers": { 
      "Connection": "close", 
      "Content-Length": "104", 
      "Content-Type": "text/plain; charset=utf-8", 
      "Date": "Thu, 13 Mar 2014 20:08:56 GMT", 
      "Server": "Apache" 
     }, 
     "status": 200, 
     "text": "TIMESTAMP=2014%2d03%2d13T20%3a08%3a56Z&CORRELATIONID=4ed210495e962&ACK=Success&VERSION=93&BUILD=10030158", 
     "uuid": "6bd97902-33fd-70d8-8a30-cebd03756d38" 
    } 
} 

所以,如果我用httpResponse.text我得到

"TIMESTAMP=2014%2d03%2d13T20%3a08%3a56Z&CORRELATIONID=4ed210495e962&ACK=Success&VERSION=93&BUILD=10030158" 

現在,因爲這並不在我看來是JSON格式的,什麼是拔的最佳途徑個別領域?我總是可以使用split("&")產生一個數組。 GOT是一個更簡單的方法。任何想法不勝感激。

此外,這是在Parse.com Cloud Code上運行。我不認爲Parse支持jQuery,但我可能是錯的。

編輯:我知道這是一個工作一輪......但這對我來說...... ...!很簡單。

 var myText = httpResponse.text; 
    var mySuccess = myText.match(/Success/g); 

回答