# Stdin

It's common that you will want to pass some input into dasel to work with.

The simplest way of doing so is sending it to `stdin`, e.g.

`echo '{"message": "Hello world"}' | dasel -i json`&#x20;

This data could be in many formats (`json`, `yaml`, etc), so it's important that you use `-i`, `--input` to specify the input file format.

Note that if you provide an input format, you must write to stdin other dasel will hang waiting for input.

## Outputting the root document with --root

By default, dasel outputs the result of the final selector. This is useful when searching for data, but not so useful when performing modifications.

```
$ echo '{
  "foo": {
    "bar": "baz"
  }
}' | dasel -i json 'foo.bar'
"baz"

$ echo '{
  "foo": {
    "bar": "baz"
  }
}' | dasel -i json 'foo.bar = "bong"'
"bong"

$ echo '{
  "foo": {
    "bar": "baz"
  }
}' | dasel -i json --root 'foo.bar = "bong"'
{
    "foo": {
        "bar": "bong"
    }
}

```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://daseldocs.tomwright.me/input-output/stdin.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
