I have a test nested JSON string.
const testString = `{
"object1": {
"5": [
{
"id": "A2OKPZ5S9F78PD",
"rate": "2",
"item": "item",
"status": "status"
}
]
},
"type": "LIVE_EVENT"
}`;
const model = JSON.parse(testString);
Object.values(model.object1).forEach((obj) =>
obj.foreach((innerObj) => console.log(innerObj))
);
As you can see above I am trying to parse this as JSON and iterate over. The problem which I am facing during JSON.parse the inner object assumes the type undefined and foreach can not be applied on it. Can some one please help ?