0

I'm trying to pull out variables from the following JSON ? formatted response using javascript:

{
    "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"
    }
}

So, if I use httpResponse.text I get

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

Now, since this doesn't appear to me as JSON format, what's the best way to pull out individual fields? I could always use split("&") resulting in an array. GOT to be an easier way. Any ideas greatly appreciated.

Also, this is running on Parse.com Cloud Code. I don't think Parse supports jQuery, but I could be wrong.

EDIT: I know this is a work-a-round.... but this works for me...! lot simpler.

        var myText = httpResponse.text;
    var mySuccess = myText.match(/Success/g);
hypermiler
  • 1,969
  • 4
  • 19
  • 27

1 Answers1

1

The values in httpResponse.text are the same format as a query string.

You can see this answer on how to parse them:

How can I get query string values in JavaScript?

Community
  • 1
  • 1
Jeremy J Starcher
  • 23,369
  • 6
  • 54
  • 74