Looking for help with filtering a JavaScript object
[
{
"comparing_result": "d_sens",
"event": "Require",
"master_field": "type_de_donnees",
"master_field_type": "Select",
"operator": "=",
"slave_field": "criticite_de_donnees",
"slave_field_type": "Select"
},
{
"comparing_result": "d_pers",
"event": "Require",
"master_field": "type_de_donnees",
"master_field_type": "Select",
"operator": "=",
"slave_field": "criticite_de_donnees",
"slave_field_type": "Select"
},
{
"comparing_result": "d_ptry",
"event": "Not Required",
"master_field": "type_de_donnees",
"master_field_type": "Select",
"operator": "=",
"slave_field": "criticite_de_donnees",
"slave_field_type": "Select"
}
]
I want to filter the object to achieve this:
[
{
"comparing_result": ["d_sens", "d_pers"],
"event": "Required",
"master_field": "type_de_donnee",
"master_field_type": "Select",
"operator": "=",
"slave_field": "criticite_de_donnees",
"slave_field_type": "Select"
},
{
"comparing_result": "d_ptry",
"event": "Not Required",
"master_field": "type_de_donnees",
"master_field_type": "Select",
"operator": "=",
"slave_field": "criticite_de_donnees",
"slave_field_type": "Select"
}
]
I'm struggling to find the right method to merge elements with same properties, except comparing_result. Any suggestions?
Thank you!