I have the following JSON:
{
"Category": [
{
"SomeKey_1": {
"Property1": 1,
"Property2": false
}
},
{
"SomeKey_2": {
"Property1": 2,
"Property2": true
}
},
{
"OtherKey_1": {
"Property1": 3,
"Property2": false
}
},
{
"OtherKey_2": {
"Property1": 4,
"Property2": false
}
}
]
}
and I would like to delete from the Category[] array those element whose key starts with or contains "Other". So as the result I would like to have this:
{
"Category": [
{
"SomeKey_1": {
"Property1": 1,
"Property2": false
}
},
{
"SomeKey_2": {
"Property1": 2,
"Property2": true
}
}
]
}
I tried to use the Select command but there I am able to select based on the values not the keys.
If all the objects in your array only contain a single property:
If you want to delete objects of which any property's key starts with "Other":
And finally, if you only want to delete those objects with only "Other" properties:
It's also possible to use the
delfilter: