jquery – Get nested JSON keys only
Example JSON
{
"one": [{
"A": {"name":"example"},
"B": {}
}],
"two": [{
"A": {"name":"booger"},
"B": {}
}]
}
Using this I can get keys “one” and “two” to be listed.
$.getJSON('blahblah.js', function(data){
$.each(data, function(key){
console.log(key);
});
});
But using this, I can’t get “A” and “B” to be listed.
$.getJSON('blahblah.js', function(data){
$.each(data.one, function(key){
console.log(key);
});
});
Why not? And how do I get those inner keys(is this the correct term?) to be listed.
Thanks
Read more here: Source link