Avoid errors when a key may be missing.
Section: Selectors and Paths
Optional selector
bash
bash
echo '{"user":{}}' | jq '.user.profile?.email'Explanation
The `?` suppresses errors for missing 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