I have the json data below and need to create a function to get all child elements based on a given parent element (Item 1-3):
{
"temps": {
"Item1": [
{
"time": 123,
"value": 155
},
{
"time": 123,
"value": 185
}
],
"Item2": [
{
"time": 123,
"value": 189
},
{
"time": 123,
"value": 192
}
],
"Item3": [
{
"time": 123,
"value": 184
}
]
]
}
}
What i already have is this each function:
$.each(data.temps,function(index, object){
// get parent items
console.log(index +'('+object.length+')')
$.each(object, function(idx, sensor) {
// get all childs
console.log(sensor);
});
});