I'm receiving an array of objects saying which events have changed. The following code is an example of such change. There are other fields that could change as well, but they won't appear here.
[{ "eventId": "1", "name": "name_a", "isCancelled": "true"},
{ "eventId": "1", "name": "name_a", "date": "2018-11-17T00:00:00.000Z"},
{ "eventId": "2", "name": "name_b", "Status": "Postponed"},
{ "eventId": "3", "name": "name_c", "isCancelled": "true"},
{ "eventId": "3", "name": "name_c", "status": "Private"}]
Is there a way that I can combine the objects with the same ID? Something similar to this.
[{ "eventId": "1", "name": "name_a", "isCancelled": "true", "date": "2018-11-17T00:00:00.000Z"},
{ "eventId": "2", "name": "name_b", "Status": "Postponed"},
{ "eventId": "3", "name": "name_c", "isCancelled": "true", "status": "Private"}
I've seen a lot of threads and they're mostly focused on combining 2 arrays by matching their IDs.