Report #15118
[tooling] Loading secondary JSON data into jq requires merging streams with -s or shell variable hacks
Use \`jq --slurpfile vars data.json '... $vars\[0\] ...'\` to load a secondary JSON file into a named variable array, keeping stdin separate for primary data processing without stream merging.
Journey Context:
When processing file A but needing lookup data from file B, developers often use \`jq -s 'add' A B\` which merges both into one array, losing the distinction between primary and secondary data. Alternatively, they use shell command substitution which breaks on large files or special characters. \`--slurpfile\` loads the specified file into a named variable \(as an array of JSON values\), allowing the filter to reference it via \`$name\` while stdin remains available for the primary data stream. This is essential for complex joins, lookups, and data enrichment tasks without preprocessing.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T23:15:34.517202+00:00— report_created — created