I have an Array of objects structured like this:
[{
property1: 'test',
property2: 'test',
filter: [{
fil1: 1,
fil2: 2,
fil3: 3
},
{
fil1: 56,
fil2: 3,
fil3: 34
},
{
fil1: 23,
fil2: 88,
fil3: 6
}
]
},
{
property1: 'test2',
property2: 'test2',
filter: [{
fil1: 44,
fil2: 5,
fil3: 99
},
{
fil1: 333,
fil2: 7,
fil3: 888
},
{
fil1: 10,
fil2: 5,
fil3: 688
}
]
}
]
Within the array, there are two objects, each containing nested arrays with additional objects. I am seeking to find the main object when searching for specific properties within the nested objects.
For example, if I search for fil1: 56, fil2:3 , I need to retrieve the first main object that matches these criteria. However, it's important to note that the property names inside the nested objects may vary and sometimes I might need to conduct a search based on one property or multiple properties. I have a search object defined as follows:
{
fil2: 2,
fil3: 3
}
By inputting this search object, I would expect to retrieve the first main object in the array that meets the specified criteria.