I am facing an issue while trying to extract data from a JSON array with nested arrays that contain spaces in their key names. Each time I attempt to execute the code, it results in an error.
var sampleError = [
{
"LessonName": "Understanding Multiplication",
"LessonID": "13343",
"no of questions": [{"Locked": "31", "Unlocked": 5}]
},
{
"LessonName": "Finding Unknown Values",
"LessonID": "13424",
"no of questions": [{"Locked": "34", "Unlocked": 5}]
}
]
function jsd(){
document.write(sampleError[0].LessonName);
document.write(sampleError[0]['no of questions'][0].Locked);
}
document.write(sampleError[0]["no of questions"][0].Locked);
does not appear as expected.