Force JSON Output to a File
Write one JSON document to a file.
Redirected output saves response body bytes by default. Choose -o json when a
script needs Restish to render decoded structured data as one JSON document.
--rsh-collect matters when pagination is involved: it asks Restish to build
one logical document before writing the file.
restish api.rest.sh/images --rsh-collect -o json > images.json
The file is pretty-printed by default. Add --rsh-print=b when compact JSON is
more useful:
restish api.rest.sh/images --rsh-collect -o json --rsh-print=b > images.json
Open the file with jq, an editor, or another tool that expects one complete
JSON value. For line-oriented pipelines, prefer -o ndjson instead; the
Output guide explains document versus record formats.
Related: Output, Output Defaults.