I've a requirement where the below array of objects should be converted to the result mentioned.
list = [{name : 'John', id : '1'}, {name : 'John', id : '2'}, {name : 'John', id : '3'}, {name : 'John', id : '4'}];
result to
list = [{name : 'John', id : '1, 2, 3, 4'}];
How can one do it?