# Merge Input Documents

## Description

This flag tells dasel to merge input documents into an array.

Note that when `--merge-input-documents` is passed, even a single document will be converted to an array.

## Usage

Pass the `--merge-input-documents` to [select](/v1/usage/select.md) or [put](/v1/usage/put.md) commands.

## Example

With the flag:

```shell
$ echo 'foo: bar
---
baz: biz' | dasel -r yaml -w json --merge-input-documents .
[
  {
    "foo": "bar"
  },
  {
    "baz": "biz"
  }
]
```

Without the flag:

```shell
$ echo 'foo: bar
---
baz: biz' | dasel -r yaml -w json .
{
  "foo": "bar"
}
{
  "baz": "biz"
}
```

## Notes

Take note that merge in this context means taking all of the input documents and adding them to a single array of those documents.

Input: `a`, `b`, `c`\
Output: `[a, b, c]`

Where:\
a: `{"number": 1}`\
b: `{"number": 2}`\
c: `{"number": 3}`

Becomes:

```json
[{ "number": 1 }, { "number": 2 }, { "number": 3 }]
```

The use of "merge" here could be mistaken in that you may expect the following output:

```json
{
  "number": 3
}
```

If you are looking for the 2nd output above, see the [merge feature request](https://github.com/TomWright/dasel/issues/133).


---

# 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/v1/usage/flags/merge-input-documents.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.
