I have a json object in the below format and am trying to retrive the grade for the key "krishna kk" which gives me an Uncaught SyntaxError: Unexpected token [
error. can any one help to understand how to get the inner object data where the key name has spaces in it.
[
{"studentinfo": [
{
"rama nathan": {
"grade": "1",
"roleno": "9",
"score": 9
}
},
{
"krishna kk": {
"grade": "3",
"roleno": "9",
"score": 4
}
},
{
"john Doe": {
"grade": "2",
"roleno": "5",
"score": 7
}
}
],
}
]
My code as below :
var stugrade = studentobject["0"].studentinfo["0"].[rama nathan].grade;