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 or put commands.

Example

With the flag:
1
$ echo 'foo: bar
2
---
3
baz: biz' | dasel -r yaml -w json --merge-input-documents .
4
[
5
{
6
"foo": "bar"
7
},
8
{
9
"baz": "biz"
10
}
11
]
12
​
Copied!
Without the flag:
1
$ echo 'foo: bar
2
---
3
baz: biz' | dasel -r yaml -w json .
4
{
5
"foo": "bar"
6
}
7
{
8
"baz": "biz"
9
}
Copied!

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:
1
[
2
{"number": 1},
3
{"number": 2},
4
{"number": 3}
5
]
Copied!
The use of "merge" here could be mistaken in that you may expect the following output:
1
{
2
"number": 3
3
}
Copied!
If you are looking for the 2nd output above, see the merge feature request.
Last modified 8mo ago