Tried parsing a JSON data obtained from json-ld
Here's the JSON snippet for reference:
{
"@context": "http://json-ld.org/contexts/person.jsonld",
"@id": "http://dbpedia.org/resource/John_Lennon",
"name": "John Lennon",
"born": "1940-10-09",
"spouse": "http://dbpedia.org/resource/Cynthia_Lennon"
}
I attempted the following:
var jsonData= {
"@context": "http://json-ld.org/contexts/person.jsonld",
"@id": "http://dbpedia.org/resource/John_Lennon",
"name": "John Lennon",
"born": "1940-10-09",
"spouse": "http://dbpedia.org/resource/Cynthia_Lennon"
};
console.log(jsonData.@context); // Error:Uncaught SyntaxError: Invalid or unexpected token
console.log(jsonData.name); // John Lenon
How can I correctly parse the @context value? Any suggestions are welcome.