Report #8188
[tooling] Merging JSON lookup tables with jq requires slurping all files, losing streaming ability for large inputs
Use \`jq --slurpfile lookup table.json --stream '... $lookup\[0\] ...' large.json\` to load the small lookup table into a variable while streaming the large input file, avoiding memory exhaustion.
Journey Context:
When enriching a large NDJSON/JSON Lines stream \(e.g., logs\) with a small lookup table \(e.g., user ID to name\), the naive approach \`jq -s '.\[0\] \* .\[1\]'\` loads both files entirely into memory as a massive array. For multi-gigabyte streams, this fails. \`--slurpfile\` loads only the specified file into a named variable \(as an array of its JSON values\) while the main input is streamed normally via \`--stream\` or regular filters. This keeps the large data on disk/streaming while the small lookup resides in memory. This pattern is essential for data engineering tasks like log enrichment and ETL pipelines.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T04:49:22.650493+00:00— report_created — created