Traverse (Read)
This is the simplest (and perhaps most used) operator. It is used to navigate deeply into yaml structures.
Simple map navigation
Given a sample.yml file of:
then
will output
Splat
Often used to pipe children into other operators
Given a sample.yml file of:
then
will output
Optional Splat
Just like splat, but won't error if you run it against scalars
Given a sample.yml file of:
then
will output
Special characters
Use quotes with square brackets around path elements with special characters
Given a sample.yml file of:
then
will output
Nested special characters
Given a sample.yml file of:
then
will output
Keys with spaces
Use quotes with square brackets around path elements with special characters
Given a sample.yml file of:
then
will output
Dynamic keys
Expressions within [] can be used to dynamically lookup / calculate keys
Given a sample.yml file of:
then
will output
Children don't exist
Nodes are added dynamically while traversing
Given a sample.yml file of:
then
will output
Optional identifier
Like jq, does not output an error when the yaml is not an array or object as expected
Given a sample.yml file of:
then
will output
Wildcard matching
Given a sample.yml file of:
then
will output
Aliases
Given a sample.yml file of:
then
will output
Traversing aliases with splat
Given a sample.yml file of:
then
will output
Traversing aliases explicitly
Given a sample.yml file of:
then
will output
Traversing arrays by index
Given a sample.yml file of:
then
will output
Traversing nested arrays by index
Given a sample.yml file of:
then
will output
Maps with numeric keys
Given a sample.yml file of:
then
will output
Maps with non existing numeric keys
Given a sample.yml file of:
then
will output
Traversing merge anchors
Given a sample.yml file of:
then
will output
Traversing merge anchors with override
Given a sample.yml file of:
then
will output
Traversing merge anchors with local override
Given a sample.yml file of:
then
will output
Splatting merge anchors
Given a sample.yml file of:
then
will output
Traversing merge anchor lists
Note that the later merge anchors override previous
Given a sample.yml file of:
then
will output
Splatting merge anchor lists
Given a sample.yml file of:
then
will output
Select multiple indices
Given a sample.yml file of:
then
will output
Last updated