I want to compare objects in array of objects based on a property value if property value of two objects match then I want to merge them my data looks like the below given array of objects.
[{
"master": "filpkart",
"business": [{
"label": "flipkart process",
"value": "flipkart.process"
}
]
}, {
"master": "amazon",
"business": [{
"label": "amazon process",
"value": "amazon.process"
}
]
}, {
"master": "chat",
"business": [{
"label": "chat process",
"value": "chat.process"
}
]
}, {
"master": "flipkart",
"business": [{
"label": "flipkart1 process",
"value": "flipkart1.process"
}
]
}
]
after comparing the above arary of objects my output should look like this
[{
"master": "filpkart",
"business": [{
"label": "flipkart process",
"value": "flipkart.process"
},
{
"label": "flipkart1 process",
"value": "flipkart1.process"
}
]
}, {
"master": "amazon",
"business": [{
"label": "amazon process",
"value": "amazon.process"
}
]
}, {
"master": "chat",
"business": [{
"label": "chat process",
"value": "chat.process"
}
]
}
]
could anyone please tell me how can I achieve this