📄
Dasel
v1
v1
  • Introduction
  • Installation
    • Update
  • Use as a go package
  • Github
  • Playground
  • Usage
    • Select
    • Put
    • Put object
    • Put document
    • Delete
    • Validate
    • Flags
      • Escape HTML
      • Format
      • Multiple
      • Null
      • Merge Input Documents
    • Supported file types
  • Selectors
    • Introduction
    • Property
    • Keys and indexes
    • Index
    • Next Available Index
    • All indexes
    • Dynamic
    • Search
    • Search Optional
    • Length
    • Type
  • Notes
    • File formatting and ordering
    • Memory usage
    • Converting between formats
  • Examples
    • JQ to Dasel
    • YQ to Dasel
    • XML
    • Filter JSON API results
Powered by GitBook
On this page
  • Description
  • Usage
  • Example
  • Notes
Edit on GitHub
  1. Usage
  2. Flags

Merge Input Documents

PreviousNullNextSupported file types

Last updated 2 years ago

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

Example

With the flag:

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

Without the flag:

$ 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:

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

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

{
  "number": 3
}

If you are looking for the 2nd output above, see the .

select
put
merge feature request