I have the following JSON structure and I need to iterate over the nested values of data.list. I'm able to get a nested value when I hard-code with the following console.log(data["list"][0]["My website is https://www.test.com"][0][0].command);
, but not when I try to iterate overall of data.list's objects.
var data = {
"list": [
{
"The first website is https://www.w3.org/": [
[
{
"command": "This is dummy content",
"new": false,
"message": "This was fun to make"
}
]
]
},
{
"The second website is https://www.mozilla.org": [
[
{
"command": "This is the second command",
"new": true,
"message": "Lorem ipsum"
}
]
]
}
],
"verified": false
};
for (var i = 0; i < data.list.length; i++) {
// this doesn't work
console.log(data.list[i][0]["0"]["0"]).command;
}