I'm working on a project, where I have to get 2 json objects to different arrays for use in the app. I want it to be done dynamically, because in the future there might be one, two, three or possibly four objects inside this json array. I know how to get the objects with hard coding the list indexes and pushing them into array, but i dont know how to do it dynamically.
Here is the JSON data that im working with:
[
{
equipment: "",
values: [
{
id: "123456",
timestamp: [
]
},
{
id: "12345",
timestamp: [
]
}
]
}
]
So, tl:dr is: How do i get both "values" objects to their own arrays? Also im working with react and typescript.