For the complete documentation index, see llms.txt. This page is also available as Markdown.

Stdout

Dasel writes to stdout.

You can modify the output with the -o, --out flag passing the required format, e.g. json, yaml etc.

$ echo '{"message": "Hello world"}' | dasel -i json -o yaml
message: Hello world

Getting the output you want

Dasel will output the result of the final expression by default, however in some cases it can be useful to output the input document, e.g.

Default behaviour

$ echo '{"user": {"name": "John"}}' |
    dasel -i json 'user.name = {"first": user.name, "last": "Doe"}'

// outputs
{"first": "John", "last": "Doe"}

With --root

$ echo '{"user": {"name": "John"}}' |
    dasel -i json --root 'user.name = {"first": user.name, "last": "Doe"}'

// outputs
{"user": {"name": {"first": "John", "last": "Doe"}}}

Compact output

By default, dasel pretty-prints structured output with indentation and newlines. Use the --compact flag to produce compact output with no extra whitespace.

This is supported for JSON, TOML, YAML, and XML formats.

Last updated