Comment on page
Flatten
This recursively flattens arrays.
Recursively flattens all arrays
Given a sample.yml file of:
- 1
- - 2
- - - 3
then
yq 'flatten' sample.yml
will output
- 1
- 2
- 3
Given a sample.yml file of:
- 1
- - 2
- - - 3
then
yq 'flatten(1)' sample.yml
will output
- 1
- 2
- - 3
Given a sample.yml file of:
- []
then
yq 'flatten' sample.yml
will output
[]
Given a sample.yml file of:
- foo: bar
- - foo: baz
then
yq 'flatten' sample.yml
will output
- foo: bar
- foo: baz
Last modified 1yr ago