I have a code written that returns a json as below.
"aggrRes": {
"totalSize": 3,
"done": true,
"records": [
{
"attributes": {
"type": "AggregateResult"
},
"expr0": "2019-02-25",
"expr1": 40,
"expr2": 27
},
{
"attributes": {
"type": "AggregateResult"
},
"expr0": "2019-02-22",
"expr1": 36,
"expr2": 9
},
{
"attributes": {
"type": "AggregateResult"
},
"expr0": "2019-02-21",
"expr1": 38,
"expr2": 12.5
}
]
}
Using this json I want to create another json. and here the format should be something like below.
in forloop:
dataset:
dates:[get all expr0 for all 3 records],
expr1:[get all expr1 for all 3 records],
expr2:[get all expr2 for all 3 records]
Here the main part that I'm confused is on how can I do the below.
var agResp = this.total_info.aggrRes;
for(int i=0; i<records.size; i++){
console.log(agResp.records[0].expr**i**);
}
Here I want to get the expr value by looping on the i
value, that will generate me expr0, expr1 and expr2 values.
Thanks