I've researched for about a day and haven't had any luck. I'm trying to access the object properties to simply add it to a typed class in JavaScript. How can i accomplish this? This is the object im receiving:
And this my code resulting in the following error:
Object.keys(selected).forEach(function (key) {
console.log(selected[key]);
});
Error:
ERROR TypeError: Cannot convert undefined or null to object
Any help is most appreciated as I've come to here as a last resort.
Object.keys(selected)... the selected in json string:
{
"selected": [
{
"Id": 4,
"Type": 0,
"Image": "",
"Name": "TestName",
"Roles": "TestRole",
"Facility": "TestFacil"
}
]
}


selected.selectedexists. Tryselected[0]and see if it works. You might also have to change the log line to ouputselected[0][key].