Saturday, 17 August 2013

Console throwing JSON.parse error with an Array

Console throwing JSON.parse error with an Array

So, my JSON response is a simple array:
[35,55]
Chrome network inspector shows it as valid JSON. However, when I use
JSON.parse on the xhr.responseText it gives me the error: Uncaught
SyntaxError: Unexpected token :
I've tried using JSON.stringify and just using it without parsing it in
JSON.parse, but then it isn't being seen as an array by JS.
JSONLint says it's valid JSON too.
I'm not sure what to do, I just want to use my xhr array as an array in JS.

No comments:

Post a Comment