I have the following JSON object and using JS/jquery I am trying to list all boom entries that have a count greater than 0
using the following JS I can access all the boom's, but as the next property is unknown, how can I access the count?
id_unknown is not known in the example, as in, I don't know what the property name is so I can't do jsonData["foo"]["id"]["bar"]["id_unknown"]; I need to step over it almost and access everything inside it
obj = JSON.parse(results);
var prod = obj['foo'][id]['bar'];
$.each(prod, function(i) {
$.each(prod[i], function(boom) {
console.log(boom);
});
});
JSON :
"foo":{
"id":{
"bar":{
"id_unknown":{
"boom":{
"count":9.0
},
"boom2":{
"count":48.0
},
"boom4":{
"count":103.0
},
"boom5":{
"count":0.0
}
}
}
}
}