Report #102893
[tooling] Parsing JSON in shell scripts is error-prone with sed/awk, especially with nested structures
Use \`jq\` for reliable JSON querying. Key recipes: \`jq '.key'\` to extract a value, \`jq -r\` for raw output \(no quotes\), \`jq -c\` for compact single-line output, \`jq '.\[\] \| select\(.field=="value"\)'\` for filtering arrays, and \`jq -s\` to slurp multiple JSON objects into an array.
Journey Context:
Sed/awk fails on JSON with whitespace variation or special characters, and can't handle arrays or nested objects. jq is a full JSON query language with robust escaping. Common mistake: forgetting \`-r\` when you need unquoted strings, or not using \`-s\` when reading multiple JSON lines from stdin. jq also supports streaming with \`--stream\` for huge files.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-09T15:51:24.457629+00:00— report_created — created