Possible Duplicate:
How do I enumerate the properties of a javascript object?
{
347655082: {
album:{
title: "A",
genre: "Pop",
}
},
347655083: {
album:{
title: "B",
genre: "Rock",
}
}
}
Normally the "outside" key is the same, so I can easily target the nested objects. In the case the "outside" key is variable which can be anything.
albums = JSON.parse(json); //parse json storing it in albums
I cannot run a foreach on albums, say "albums has not method foreach".
albums.forEach(function(album, i){
}