javascript - Unexpected Token while Parsing JSON -


this fraustating me 5 hours , have ask question.

i trying parse json using javascript, don't know why getting error on console:

uncaught syntaxerror: unexpected token (…) (anonymous function) @ vm382:2injectedscript._evaluateon @  vm251:904injectedscript._evaluateandwrap @ vm251:837injectedscript.evaluate  @vm251:693 

json : http://pastebin.com/dddxqj6d

js code:

var json=**big json**; var obj=json.parse(json); 

tried:

json.stringify(json);

json= "'" + json+ "'";

loading json url

according jsonlint , pastebin posted, json invalid, due use of \'. once replace of them ', should work normally.

in original json file there going occurrences of \\'. string become \'.

if you’re using linux, simple

sed -i "s/\\\\\\\'/\'/g" yourjsonfile.json 

on file fixes everything.

jsonlint says “valid json” then.

you can try

json.parse(json.replace(/\\'/,'\'')); 

Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -