I have a json file which is generated by Java component and I trying to parse that json file via Javascript. But if I use this code:
var foo = JSON.parse('js/test.json');
I am getting this error:
Uncaught SyntaxError: Unexpected token :
Strange is I am generating this JSON via JSONObject which of-course produces valid JSON string. I tried with few online validators, and all of them are showing as a valid json. But javascript is throwing me this error.
Can anyone guide me to resolve this error? I searched many questions on SO but no luck. I posted my json here
jsfolder in web app.JSON.parsetakes a string of JSON, not a filename/url.