My data array structure is as follows:
{
"filters": [
{
"filterProperty": "companyType",
"filterValues": [
"Private"
]
},
{
"filterProperty": "city",
"filterValues": [
"Mumbai",
"SanJose",
"Shanghai"
]
}
]
}
I have implemented filters on this array. Now, I am removing them one by one and making API calls with the remaining filters.
If I want to remove only "Mumbai" from the filter property "city", while keeping the rest of the filter values intact, how do I achieve this?
"filters": [
{
"filterProperty": "companyType",
"filterValues": [
"Private"
]
},
{
"filterProperty": "city",
"filterValues": [
"Mumbai",
"SanJose",
"Shanghai"
]
}
]
let data = filters.splice(a=> a.filterProperty === 'city' && a.filterValues.filter(b => b !== "Mumbai"))