I have a json of type
{
"success": true,
"dataPoints": [{
"count_id": 4,
"avg_temperature": 2817,
"startTime": "00:00:00",
"endTime": "00:19:59.999"
}, {
"count_id": 4,
"avg_temperature": 2814,
"startTime": "00:59:59.997",
"endTime": "01:19:59.996"
}, {
"count_id": 4,
"avg_temperature": 2816,
"startTime": "00:39:59.998",
"endTime": "00:59:59.997"
}, {
"count_id": 4,
"avg_temperature": 2825,
"startTime": "02:19:59.993",
"endTime": "02:39:59.992"
}, {
"count_id": 4,
"avg_temperature": 2828,
"startTime": "02:39:59.992",
"endTime": "02:59:59.991"
}, {
"count_id": 4,
"avg_temperature": 2832,
"startTime": "02:59:59.991",
"endTime": "03:19:59.99"
}, {
"count_id": 4,
"avg_temperature": 2841,
"startTime": "03:39:59.989",
"endTime": "03:59:59.988"
}, {
"count_id": 4,
"avg_temperature": 2816,
"startTime": "01:39:59.995",
"endTime": "01:59:59.994"
}, {
"count_id": 5,
"avg_temperature": 2668,
"startTime": "04:19:59.987",
"endTime": "04:39:59.986"
}, {
"count_id": 3,
"avg_temperature": 2711,
"startTime": "05:19:59.984",
"endTime": "05:39:59.983"
}, {
"count_id": 9,
"avg_temperature": 2697,
"startTime": "03:59:59.988",
"endTime": "04:19:59.987"
}, {
"count_id": 4,
"avg_temperature": 2560,
"startTime": "05:59:59.982",
"endTime": "06:19:59.981"
}, {
"count_id": 4,
"avg_temperature": 2837,
"startTime": "03:19:59.99",
"endTime": "03:39:59.989"
}]
I want the list of all the avg_temperature values from this json object.
getHistoryData() {
this.historyDataService.getHistoryData(this.payload)
.subscribe((data : any) => this.response = data.dataPoints[0].avg_temperature)
}
I am capturing my response this way which gives me one particular value , but i want all the values of avg_temperature. How do I loop through the response/ get all the avg_temperature values. Similarlly I want to store all the others parameters like startTime , endTime in an array and use them in some other place