I am currently exploring ways to retrieve all entries within a JSON payload using JavaScript. Specifically, I am interested in finding the best method to extract all instances of "o4" in a specific order (-159, -257). How can this be achieved?
{
data: {
'1613152800': {
i0: -264,
i1: 297,
i2: -260,
i3: 270,
i4: -159,
i5: 0,
i6: -7,
i7: 145
},
'1613153400': {
i0: 261,
i1: -239,
i2: 125,
i3: -214,
i4: -257,
i5: 3,
i6: -237,
i7: -128
}
}
}
While this example showcases two primary entries ('1613152800' and '1613153400'), it is essential to note that there might be numerous such entries present.
Moreover, it's important to mention that I won't have prior knowledge of the main entry ids, meaning that '1613152800' and '1613153400' will always remain unidentified. Therefore, I cannot rely solely on
var json = JSON.parse(data);
console.log(json.data['1613152800'].i4);
as an approach.
Your insights would be greatly appreciated. Thank you!