I have the following valid json (partially shown), which I have received as a response to an HTTP request (I don't control the server):
"TotalResults":2,"SearchTerm":"XX","SearchTermClean":"XX","SearchTermExact":"\"XX\"","SearchTermNonExact":"XX","Page":1,"PageSize":100,"TotalPages":1,"TotalTime":0.072,"Filter":"","Sort":"","SortClean":"","IsDesc":false,"PreviousPage":1,"NextPage":1}'
I'm trying to parse this JSON using:
var json_obj= JSON.parse(helpers.testJSON());
where testJSON returns an entire string of json.
I'm getting:
Uncaught SyntaxError: Unexpected token X in JSON at position 1685
which translates to:
":"\"XX\""
How can I fix this error? I assume I would need to preprocess the JSON before using JSON.parse