I want to merge objects with same key into one single object. For example the first array below is the array I am having. I want to convert it into second array
CONVERT BELOW
[
{
"speed": 779.5,
"id": 1
},
{
"code": "04.x.D3",
"id": 1
},
{
"temperature": 49,
"id": 1
},
{
"range": 0,
"id": 1
},
{
"temperature": 41,
"id": 2
},
{
"range": 3,
"id": 2
}
]
INTO THIS
[
{
"speed": 779.5,
"code": "04.x.D3",
"temperature": 49,
"range": 0,
"id": 1
},
{
"temperature": 41,
"range": 3,
"id": 2
}
]
2
Answers