I am trying to learn JSON, i learned that any javascript object with the key in double quotes are considered as JSON object.
And i constructed this object
var jstr1 = {"mykey": "my value"};
But when i try to parse using JSON.parse(jstr1), i got the following error. see the screenshot.
But when i try to parse this
var jstr = '{"mykey": "my value"}';,
i got the success, see the screenshot. i got confused with this. Please explain me why this happens. what is the difference between the two forms.
And when i got JSON as a response from any services, how it would look like, whether it will be in form of jstr
or jstr1
thanks in advance for any help.