From the following input:
{
"key1": {
"key_x": "1",
...
"key_z": "2"
},
"key2": {
"key_x": "2",
...
"key_z": "3"
}
}
I would like to exclude all keys with the name "key_x"
so the result should be
{
"key1": {
...
"key_z": "2"
},
"key2": {
...
"key_z": "3"
}
}
You can use the del()
function:
jq 'del(.[]|.key_x)' input.json
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With