let obj = {
"data": [
{
id : "a1",
guid : "sdfsfd",
value : "abc",
"status": "active"
},
{
id : "a2",
guid : "deaf",
value : "def2",
details : {
"status": "inactive",
"body": done
}
"stat": "inactive"
},
{
id : "a2",
guid : "blind",
value : "def4",
details : {
"status": "inactive",
"body": donenot
}
"stat": "inactive"
},
]
}
console.log(obj.data.filter(item => item.stat === "inactive"))
RESULTS
[{
details: {
body: "done",
status: "inactive"
},
guid: "deaf",
id: "a2",
stat: "inactive",
value: "deaf"
}, {
details: {
body: "donenot",
status: "inactive"
},
guid: "blind",
id: "a3",
stat: "inactive",
value: "blind"
}]
If I wish to ensure
- The value of each inactive entry (in these results) should be the same as their guid value...?
- The value of each inactive entry (in these results) should match the body within their respective details section...?