Report #78800
[tooling] Using jq in shell scripts to check JSON conditions
Use \`jq -e '.some\_property' file.json\` which exits with code 0 if the output is neither null nor false, and exits 1 otherwise. This allows direct use in shell \`if\` statements without parsing output strings.
Journey Context:
Without \`-e\`, jq always exits 0 unless there's a syntax error, forcing scripts to check if the output is the string 'null' or 'false' using string comparison. The \`-e\` \(exit status\) flag makes jq behave like a proper Unix filter, enabling idiomatic shell usage like \`if jq -e '.enabled' config.json >/dev/null; then ... fi\` without capturing output.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T14:51:39.052360+00:00— report_created — created