I have array of objects like this:
data = [
{
"name":"abc",
"email":"abc@gmail.com"
},
{
"name": "bcd",
"email": "bcd@gmail.com",
"info":[
{
"email": "bcd@gmail.com",
"count":5
}
]
},
{
"name": "hfv",
"email": "hfv@gmail.com",
"info":[
{
"email": "hfv@gmail.com",
"count":5
},
{
"email": "hfv@gmail.com",
"count":7
}
]
}
]
I want to to change data
in such a way that only objects that have count>1
should exist
so the output should like this:
[{
"name": "bcd",
"email": "bcd@gmail.com",
"info":[
{
"email": "bcd@gmail.com",
"count":5
}
]
},
{
"name": "hfv",
"email": "hfv@gmail.com",
"info":[
{
"email": "hfv@gmail.com",
"count":5
},
{
"email": "hfv@gmail.com",
"count":7
}
]
}
]
the data
array should look like this, how I can I loop through this array of objects and remove objects that have count<=1?