I've got this data serialized by JSON to string:
var json = '[{"data":{"id":2,"gid":3,"name":"Travis","surname":"Stewart","skin":0}},{"data":{"id":3,"gid":3,"name":"Ziutek","surname":"Stewart","skin":0}}]';
And now im going to parse this back to object, like:
var charData = JSON.parse(json);
How can i get data from this for each datas?
for(var char in charData.data) {
console.log(char.id);
}
This wasn't work... Any other solutions?
Error: Cannot read property 'id' of undefinedcharData.datais wrong. You have to loop over each array item, and access the itemdataproperty ; this is not what you've done