I have the following input
[
{
"id": "abc",
"data1": 3,
"data2": "test1",
},
{
"id": "abc",
"data1": 4,
"data2": "test1",
},
{
"id": "xyz",
"data1": 2,
"data2": "test2",
}
]
I would like to parse this list, convert the data1 to list and add all the data1 with similar id into it like the following to create new list.
[
{
"id": "abc",
"data1": [3,4],
"data2": "test1",
},
{
"id": "abc",
"data1": [2],
"data2": "test2",
}
]
I have tried a few ways like using map/reduce but none of my solution worked.