merge two key values if it is same in an array of objects

29 Views Asked by At
[
    {
        "a": 'test',
        "b": "10er"
    },
    {
        "a": 'test',
        "b": "yt45"
    },
]

if value of "a" is same in both the objects then i want to merge the value of b into single object

[
  {
    "a":'test',
    "b":'10er,yt45'
    }
]

i have tried getting the duplicates and then tried to merge those with the reamining but no luck.

expectation if value of "a" is same in both the objects then i want to merge the value of b into single object

[
  {
    "a":'test',
    "b":'10er,yt45'
    }
]
0

There are 0 best solutions below