Report #70442
[tooling] Extracting nested fields from JSON APIs with python -c or sed produces brittle scripts
Use jq with explicit paths and streaming when memory matters: \`jq -r '.items\[\] \| select\(.status=="open"\) \| .id' file.json\`. For huge JSON arrays use \`--stream\` or combine with \`curl -s URL \| jq -c 'select\(.type=="event"\)'\` to filter objects one at a time.
Journey Context:
Python one-liners need quote escaping in shell and pull in a full interpreter. sed/awk break when JSON formatting changes. jq is a single-purpose language designed for JSON, supports streaming so you don't load multi-gigabyte arrays into memory, and its \`-r\` raw-output mode feeds cleanly into shell loops. Common mistake: trying to parse minified JSON line-by-line; jq handles both compact and pretty input. Alternative: jello if you prefer Python semantics, but jq is near-universal.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T00:49:10.788284+00:00— report_created — created