I am trying to filter this json.
here is the json
const json = {
address: "fdqn",
pDet: [
{
pNam: "pnam1",
pMem: [
{
mIP: "1234", // search this string '1234'
gp: "gp1"
}, {
mIP: "567",
gp: "gp2"
}, {
mIP: "890",
gp: "gp3"
}
]
},
{
pNam: "pnam1",
pMem: [
{
mIP: "4567",
gp: "gp5"
}, {
mIP: "5674",
gp: "gp7"
}
]
}
]
}
I need to filter with mIP = "1234" and the final output should be.
const json = {
address: "fdqn",
pDet: [
{
pNam: "pnam1",
pMem: [
{
mIP: "1234",
gp: "gp1"
}
]
}
]
}
i tried with filter and some but seems i need to iterate inside the filter. any input will be appreciated