mirror of
https://github.com/mikefarah/yq.git
synced 2024-12-19 20:19:04 +00:00
387 B
387 B
Keys
Use the keys
operator to return map keys or array indices.
Check node is a key
Given a sample.yml file of:
a: frog
then
yq '[... | { "p": path | join("."), "isKey": is_key, "tag": tag }]' sample.yml
will output
- p: ""
isKey: false
tag: '!!map'
- p: a
isKey: true
tag: null
'!!str': null
- p: a
isKey: false
tag: '!!str'