Stdout mode (default)
Without -i, nesdit reads the input file, applies the query, and writes the result to stdout. The file on disk is never touched.
Basic usage
Input (config.json):
Stdout:
config.json on disk: unchanged.
Piping to another command
Because the result goes to stdout, you can pipe it anywhere:
Or redirect to a new file:
Cross-format transcoding
Use --output-format to produce a different format than the input:
Input (input.json):
Stdout:
See examples/formats for all six format combinations.
Identity query
The default query is . (identity). If you omit --query, nesdit normalises and round-trips the file through its decoder and encoder:
This is useful for normalising a file to nesdit's canonical encoding. The output is always idempotent: running it a second time produces byte-identical output.
Multiple files to stdout
When multiple files are passed (all the same format), outputs are concatenated with the appropriate framing:
- YAML files:
---separators between documents. - JSON files: one JSON object per line (JSONL).
Output:
Warning
Mixing formats in one invocation is an error:
Related flags
-i/--in-place— write back to disk instead of stdout.--output-format— transcode to a different format.--format— override input format detection.--query— the jq-style query to apply.