yq/pkg/yqlib/doc/keys.md
2021-11-03 22:37:07 +11:00

370 B

Keys

Use the keys operator to return map keys or array indices.

Map keys

Given a sample.yml file of:

dog: woof
cat: meow

then

yq eval 'keys' sample.yml

will output

- dog
- cat

Array keys

Given a sample.yml file of:

- apple
- banana

then

yq eval 'keys' sample.yml

will output

- 0
- 1