yq/pkg/yqlib/doc/Collect into Array.md
Mike Farah f7f8bed955 wip
2020-12-27 09:55:21 +11:00

450 B

Collect into Array

This creates an array using the expression between the square brackets.

Collect empty

Running

yq eval --null-input '[]'

will output

[]

Collect single

Running

yq eval --null-input '["cat"]'

will output

- cat

Collect many

Given a sample.yml file of:

a: cat
b: dog
'': null

then

yq eval '[.a, .b]' sample.yml

will output

- cat
- dog