I am trying to filter an array, based on some nested object.
the final value would be the main object.
this is the data I have.
JSonData = [
{
"ID": 1,
"Name": "0ABCDDDD",
"Business Profile Owner": "owner ",
"Folder": "out-of-the-box strategize methodologies",
"Profile Type": "Greenholt",
"status": "low"
"Risk": [
{
"ID": 1.1,
"Name": "Tiaxxxxxnna",
"Risk Owner": "Lindgren",
"Risk Taxonomy": "Lindgren",
"status": "high"
"Control": [
{
"ID": 1.2,
"Name": "rrrrrrrrrr",
"Control Owner": "333333",
"Control Hierarchy": "North Laurineshire",
"Control Type 3": "Jerde Spring",
"status": "high"
},
{
"ID": 1.21,
"Name": "cccccccActive",
"Control Owner": "333333",
"Control Hierarchy": "North Laurineshire",
"Control Type 3": "Jerde Spring",
"status": "low"
}
]
},
{
ID: 1.11,
Name: "Tiaxxxxxnna",
"Risk Owner": "rRrrrrrrrrrrr",
"Risk Taxonomy": "rrrrrrrrrrrr",
"status": "low"
}
]
}, {
"ID": 2,
"Name": "dddd0ABCDDDD",
"Business Profile Owner": "ddddd ",
"Folder": "strategize methodologies",
"Profile Type": "ssd",
"status": "high"
"Risk": [
{
"ID": 2.1,
"Name": "deeeeeec",
"Risk Owner": "Lindgren",
"Risk Taxonomy": "Lindgren",
"status": "high"
"Control": [
{
"ID": 2.2,
"Name": "3Active",
"Control Owner": "333333",
"Control Hierarchy": "North Laurineshire",
"Control Type 3": "Jerde Spring",
"status": "high"
},
{
"ID": 2.21,
"Name": "55555Active",
"Control Owner": "333333",
"Control Hierarchy": "North Laurineshire",
"Control Type 3": "Jerde Spring",
"status": "low"
}
]
},
{
ID: 2.11,
Name: "33333333",
"Risk Owner": "eeeeeeee",
"Risk Taxonomy": "wwwwwwwww",
"status": "high"
}
]
}, {
"ID": 3,
"Name": "WWWW",
"Business Profile Owner": "Business Profile",
"Folder": "strategize",
"Profile Type": "cccccc",
"status": "high"
"Risk": [
{
"ID": 3.1,
"Name": "ruchas",
"Risk Owner": "boss",
"Risk Taxonomy": "8989889",
"status": "high"
"Control": [
{
"ID": 3.2,
"Name": "Active",
"Control Owner": "eeeeee",
"Control Hierarchy": "North",
"Control Type 3": "Jerde",
"status": "low"
},
{
"ID": 3.21,
"Name": "Active1",
"Control Owner": "wwwwww",
"Control Hierarchy": "Laurineshire",
"Control Type 3": "Spring",
"status": "high"
}
]
},
{
ID: 3.11,
Name: "EEEE",
"Risk Owner": "eeeeeeee",
"Risk Taxonomy": "wwwwwwwww",
"status": "low"
}
]
}
];
The multiple values which are selected from multi-select are
[{name: 'Business Profile', type: 'bp'}
{name: 'Low', type: 'risk'}
{name: 'Active', type: 'control'}]
here ‘bp’ is the main object (ID’s which are 1,2,3).
risk and control are nested objects/ Array.
it should return the following object since it matches all records.
(selected records should work with && operations)
{
"ID": 3,
"Name": "WWWW",
"Business Profile Owner": "Business Profile",
"Folder": "strategize",
"Profile Type": "cccccc",
"status": "high"
"Risk": [
{
"ID": 3.1,
"Name": "ruchas",
"Risk Owner": "boss",
"Risk Taxonomy": "8989889",
"status": "low"
"Control": [
{
"ID": 3.2,
"Name": "Active",
"Control Owner": "eeeeee",
"Control Hierarchy": "North",
"Control Type 3": "Jerde",
"status": "low"
}
]
},
{
ID: 3.11,
Name: "EEEE",
"Risk Owner": "eeeeeeee",
"Risk Taxonomy": "wwwwwwwww",
"status": "low"
}
]
}