Return true if an object has a key.
Section: Selectors and Paths
Check whether key exists
bash
bash
echo '{"name":"alice"}' | jq 'has("name")'Explanation
Use `has()` for existence checks before dereferencing fields.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Selectors and Paths