Report #82320
[tooling] Need to combine data from multiple JSON files or inject a static lookup table into a transformation
Use \`jq --slurpfile varname file.json '... $varname ...'\` to load file.json as an array into $varname, or \`--argfile\` for single objects. Access via \`$varname\[\]\`.
Journey Context:
Developers often pipe multiple files into jq with \`--slurp\` \(-s\), but this merges the input stream into one array, losing file boundaries. \`--slurpfile\` \(or -R with \`fromjson\` hacks\) allows loading auxiliary data as a variable without consuming stdin. This is critical for lookup tables \(e.g., mapping user IDs to names from a static file\) or joining streams. The alternative \`--argfile\` is similar but requires the file contain exactly one JSON value per line \(or one total\), while \`--slurpfile\` always produces an array of the file's values. This distinction matters for empty files \(slurpfile gives \[\], argfile errors\).
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T20:46:10.298910+00:00— report_created — created