A JSON file with various data points is available:
{
"success": true,
"dataPoints": [{
"count_id": 4,
"avg_temperature": 2817,
"startTime": "00:00:00",
"endTime": "00:19:59.999"
},
...
I am trying to extract all the values of 'avg_temperature' from this JSON object.
getHistoryData() {
this.historyDataService.getHistoryData(this.payload)
.subscribe((data : any) => this.response = data.dataPoints[0].avg_temperature)
}
Currently, I am able to capture only one value of 'avg_temperature'. However, I need a way to loop through the response and retrieve all the 'avg_temperature' values. Additionally, I want to save other parameters like 'startTime', 'endTime' in an array for future use.