Hello everyone,
I wanted to seek some advice regarding a task I'm currently working on. I have a complex JSON that I'm fetching from an API, and I need to extract specific data from it to populate an SQL database. Specifically, I am interested in retrieving the temperature, distance, and readTimestamp when the type is "lastil90ReadingsV1" and the readingType is "laser".
At the moment, my approach involves creating an Object variable and then converting it into an Array. After converting the JSON to an Array, I filter the array to extract the relevant data, and then I parse the JSON. Finally, I send the extracted data to an SQL database.


However, I encounter a challenge with this method as I need to hardcode the keys of the objects. As the JSON will become larger with hundreds of objects instead of just nine, my current solution is not feasible for the future.
I'm looking for a more dynamic approach to create an array from all the objects without hardcoding their keys. If anyone has suggestions or alternative methods, I would greatly appreciate your input. I've attached a snippet of the JSON for reference. Feel free to ask for further clarification if needed.
Thank you in advance for your help and suggestions!