PAPI also supports an alternate remove
JSON Patch operation. This allows you to pop elements from an array, rather than replace the entire array.
For example, suppose you have a fileExtension
criteria that matches .imm
files. You can use this expression to match it within the criteria's values
:
$..criteria[?(@.name == 'fileExtension'].options.values[?(@ == 'imm')]
You then specify a patch to remove
the element from the array:
"patches": [
{
"op": "remove",
"path": "/rules/children/0/criteria/1/options/values/0"
}
]