I have an array with values per date but would like to sum up all values on hour instead of separate date/hour. I guess I could iterate over it and remove yyyy-mm-dd and then sum up on duplicate hour object but is there a smarter way?
{
"series": [
{
"value": 1,
"category": "2021-03-04T04:00:00.000"
},
{
"value": 2,
"category": "2021-03-04T05:00:00.000"
},
{
"value": 3,
"category": "2021-03-04T06:00:00.000"
},
{
"value": 1,
"category": "2021-03-05T04:00:00.000"
},
{
"value": 2,
"category": "2021-03-05T05:00:00.000"
},
{
"value": 3,
"category": "2021-03-05T06:00:00.000"
}
]
}
]
So the array below should only be:
[
{
"series": [
{
"value": 2,
"category": "04:00:00.000"
},
{
"value": 4,
"category": "05:00:00.000"
},
{
"value": 6,
"category": "06:00:00.000"
}
]
}
]