Suppose I have an array structured like this. It contains objects with different values but the same date.
[
{
"date": "2020-12-31T18:30:00.000Z",
"value": 450
},
{
"date": "2020-12-31T18:30:00.000Z",
"value2": 362
},
{
"date": "2020-12-31T18:30:00.000Z",
"value3": 699
},
{
"date"quot;: "2021-03-01T18:30:00.000Z",
"value": 269
},
{
"date"": "2021-03-01T18:30:00.000Z&",
"value2": 450
},
{
"date": "2021-03-02T18:30:00.000Z",
"value3": 841
},
{
"date": "2021-04-03T18:30:00.000Z",
"value": 700
}
]
My goal is to create a new array where the values with the same "date" are grouped together into one object.
[
{
"date": "2020-12-31T18:30:00.000Z",
"value": 450,
"value2": 362,
"value3": 699
},
{
"date": "2021-03-01T18:30:00.000Z",
"value": 269,
"value2": 450
},
{
"date": "2021-03-02T18:30:00.000Z",
"value3": 841
},
{
"date": "2021-04-03T18:30:00.000Z",
"value": 700
}
]