I have an input array of objects :
[{
"title": "popo",
"Id": "123",
"name": "john"
},
{
"title": "test",
"Id": "123",
"name": "word"
},
{
"title": "lala",
"Id": "222",
"name": "ref"
},
{
"title": "mood",
"Id": "222",
"name": "trap"
}]
And I need an output array of objects like this:
[{
AppId: "123",
Titles: {
'popo' : 'name',
'test' : 'word',
}
},
{
AppId: "222",
Titles: {
'lala' : 'ref',
'mood' : 'trap',
}
}]
which is grouping the data by the Id and manipulating key names. I tried using lodash and Array/Object functions but I cant get the result I want. Any idea how to approach this?