Suppose I have this array:
[
{"type": "A", "status": "CREATED", "name": "Jack"},
{"type": "A", "status": "CREATED", "name": "John"},
{"type": "A", "status": "UPDATED", "name": "Alex"},
{"type": "B", "status": "UPDATED", "name": "Jane"}
]
and I want to have a new array grouped by "type" and "status" and have the names in a list. This is the desired output:
[
{"type": "A", "status": "CREATED", "name-list": ["Jack", "John"]},
{"type": "A", "status": "UPDATED", "name-list": ["Alex"]},
{"type": "B", "status": "UPDATED", "name-list": ["Jane"]}
]
as you can see the first object of the array contains 2 names because belong to the same "type" and "status". (name-list is just an example, could also remain name, the important thing is that it should be an array of strings/objects)
I have to represent these data in an html page and so needs to be able to cycle them via JavaScript.