Report #99205
[tooling] Need to query or edit JSON files in a shell script without Python/Node one-liners
Use \`jq '.key = "value"' file.json \| sponge file.json\` to edit in place \(\`sponge\` is from moreutils\), or \`jq --arg v "$VAR" '.key = $v' file.json\` to inject shell variables safely. For huge files, use \`--stream\` to process without loading everything into memory.
Journey Context:
Shelling out to Python for JSON invites quoting bugs; using \`sed\` on JSON is fragile. \`jq\` is purpose-built and composes in pipelines. \`-r\` removes surrounding quotes for string outputs. Common mistake: redirecting into the same file \(\`jq ... file.json > file.json\`\) truncates it; use \`sponge\` or write to a temp file and move.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-29T04:44:59.403432+00:00— report_created — created