I got an array like this and I need to filter this array with the same user id with all the occurrences with the service_id corresponding to user_id:
Array [
Object {
"service_id": 14,
"user_id": 56,
},
Object {
"service_id": 19,
"user_id": 59,
},
Object {
"service_id": 18,
"user_id": 56,
},
Object {
"service_id": 18,
"user_id": 56,
},
]
And I need to filter the array like this:
Array [
Object {
"user_id": 56,
[
{"service_id":14},
{"service_id": 18}
]
},
Object {
"user_id": 59,
[
{"service_id": 19},
]
},
]