Report #100144
[tooling] Extracting nested JSON fields in shell scripts with sed/awk is fragile
Use jq -r '.items\[\] \| select\(.state == "open"\) \| .title'. Pass shell values safely with --arg name value or --argjson id 42, never with string interpolation.
Journey Context:
Python one-liners or regex on JSON break as soon as whitespace or escaping changes. jq treats JSON as a stream of values, so it composes with pipes like Unix tools. The classic mistake is embedding shell variables directly into the jq expression, which is a shell-injection risk. --arg/-argjson separates data from code. Use -r for raw strings and map/flatten when normalizing arrays.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-01T04:43:55.972417+00:00— report_created — created