We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I've got a JSON file that looks something like this:
{ "results" : { "groups" : {"alpha" : { "items": { "apple" : { "attributes": { "class": "fruit" } }, "pear" : { "attributes" : { "class": "fruit" }}, "dog" : {"attributes" : {"class": null }} }}, "beta": {"items": { "banana" : { "attributes": { "class": "fruit" } } }}}}}
I want to find keys of items where class is null. I cannot figure out how to do this using jq.
The text was updated successfully, but these errors were encountered:
Something like
. as $object | keys[] | select($object[.].class == null)
should do the trick. The . as $object saves the input in $object, which you can refer to later to select specific keys.
. as $object
Sorry, something went wrong.
No branches or pull requests
I've got a JSON file that looks something like this:
I want to find keys of items where class is null. I cannot figure out how to do this using jq.
The text was updated successfully, but these errors were encountered: