I have two array as follows :
data = [
{
"is_new":1,
"is_delayed":0,
"is_active":1,
"name":"london"
},
{
"is_new":1,
"is_delayed":1,
"is_active":0,
"name":"paris"
},
{
"is_new":1,
"is_delayed":0,
"is_active":1,
"name":"India"
}
]
secondArray = ["is_new","is_delayed","is_active"] -- this array can have one element, two element or three elements at runtime
I want to filter data array such that whatever values matches in second array should have value 1 in that element of data array. For example in second array if three elements i.e "is_new","is_delayed","is_active" are present, then I want to check for first element in data array for any of these value is 1, then add that element in a result array. How can I do that?