Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
82
rated 0 times [  86] [ 4]  / answers: 1 / hits: 26458  / 7 Years ago, wed, may 24, 2017, 12:00:00

I have the Json data , which I am trying to parse in the following fiddle



but its throwing error




Uncaught SyntaxError: Unexpected token p in JSON at position 15




I am unable to paste the json here due to the large size kindly follow the fiddle



var varArray = JSON.parse(jsonData);

console.log(varArray);


Fiddle



https://jsfiddle.net/ffeLtaa6/



any suggestion ?


More From » json

 Answers
18

You have incorrectly wrapped parts of your JSON in quotes



[{pricing:{price: .... 
^
This shouldn't be here


...



.... standingCharge: y}}}]
^
This shouldn't be here


Alternatively, maybe you ARE supposed to have that part wrapped, but then you need to properly escape all backslashes within that part, i.e. \ instead of just .

In that case, when you do JSON.parse(jsonData) you would get objects (inside the array) that all have a single property, pricing, with a value that is itself a JSON string.


[#57675] Monday, May 22, 2017, 7 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
shylaelisan

Total Points: 37
Total Questions: 94
Total Answers: 110

Location: Angola
Member since Tue, May 5, 2020
4 Years ago
;