Read all JSON inputs and wrap them into an array.
Section: Files, Slurp, and Streams
Slurp inputs into one array
bash
bash
jq -s '.' file1.json file2.jsonExplanation
`-s` slurps all input documents into one array before applying the filter.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Files, Slurp, and Streams
Read whole raw file as one string
Slurp plain text into one string value.
Convert JSON lines into array
Turn multiple JSON documents into a single array.
Read raw lines as strings
Treat input as plain text lines instead of JSON.
Use streaming parser
Process large JSON incrementally as path/value events.
Pretty-print JSON from stdin
Format JSON read from stdin with default pretty output.