📖
yq
📖
yq
📖
yq
📖
yq
v4.x
yq
Upgrading from V3
Commands
Evaluate
Evaluate All
Shell Completion
Operators
Add
Alternative (Default value)
Anchor and Alias Operators
Assign
Boolean Operators
Collect into Array
Comment Operators
Create, Collect into Object
Delete
Document Index
Env Variable Operators
Equals
File Operators
Has
Keys
Length
Multiply
Path
Pipe
Recursive Descent (Glob)
Select
Sort Keys
Split into Documents
String Operators
Style
Tag
Traverse
Union
Usage
Output format
Working with JSON
Tips, Tricks, Troubleshooting
Github Page
Powered by GitBook

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
Previous
Has
Next
Length
Last updated 6 days ago
Contents
Map keys
Array keys