I have a JSON Data that I am getting from URL. I want to merge the data which has same Value Below is the sample data. I have searched through the Internet,but i didn't got the solution. All i found is for same Keys.
[ {
"banana": [
{
"color": yellow,
"size": "small"
},
{
"size": "medium"
},
{
"size": "large"
}
],
"process_name": "fruits"},{
"carnivores": [
{
"name": "lion"
},
{
"name": "tiger"
},
{
"name": "chetah"
},
{
"name": "dianosaur"
}
],
"process_name": "animal"}, {
"apple": [
{
"color": red,
"size": "large"
}
],
"process_name": "fruits"}]
And I want to merge the data of "process_name" :"fruits" into one array as below and the result should be
[{
"banana": [
{
"color": yellow,
"size": "small"
},
{
"size": "medium"
},
{
"size": "large"
}
],
"apple": [
{
"color": red,
"size": "large"
}
],
"process_name": "fruits" }, {
"carnivores": [
{
"name": "lion"
},
{
"name": "tiger"
},
{
"name": "chetah"
},
{
"name": "dianosaur"
}
],
"process_name": "animal"}]
can anyone help on this?