You don't need to use --yaml-output flag, which tries to parse the output of the filter defined as a YAML entity. For getting the raw strings, use a filter in the JSON context itself

yq -r '.images.tags[]'
Answer from Inian on Stack Overflow
🌐
yq
mikefarah.gitbook.io › yq › operators › keys
Keys | yq - GitBook
October 29, 2022 - Use the keys operator to return map keys or array indices.
🌐
yq
mikefarah.gitbook.io › yq › operators › select
Select | yq - GitBook
Select is used to filter arrays and maps by a boolean expression · equals / not equals (==, !=) operators here
Discussions

shell - Yq: retrieve object keys names - Stack Overflow
I have a YAML file (docker-compose file in my case) that looks like this: networks: foo: some_opts: "covfefe" bar: some_opts: "such wow" services: apache: image: 'apache:... More on stackoverflow.com
🌐 stackoverflow.com
bash - How to use `yq` to select key-value pairs and format them into "$key=$value" style outputs? - Stack Overflow
Let say I have YAML file that looks like this: FOO: somefoo BAR: somebar I would like to convert this (using yq) into the following so that I can source the contents into environment variables: ex... More on stackoverflow.com
🌐 stackoverflow.com
Selecting elements from map could be simplified
From what I have seen so far, selecting elements from map using with_entries/select idiom could be simplified by using styles similar to how jq does country: name: Australia capital: Canberra type: Continent And we run a command: yq '.co... More on github.com
🌐 github.com
5
February 10, 2022
How do I select multiple keys for output?
This seems like a basic question but I can't find examples anywhere in the documentation. If I have input like - alpha: 1 beta: foo gamma: 0.3 delta: bar - alpha: 2 beta: baz gamma: 1.23 delta: buz... More on github.com
🌐 github.com
14
October 29, 2019
🌐
Medium
pavolkutaj.medium.com › how-to-use-yq-to-read-a-simple-value-from-a-top-level-key-in-a-config-yaml-file-26e1fabf549
How to use yq to read a simple value from a top-level key in a config.yaml file | by Pavol Z. Kutaj | Medium
December 27, 2022 - use yq command to call the module · use -e flag to extract the value from a ke · use dotted notation to specify a key that you want the value of with .<key> syntax (of course, chainable) follow the key specification with the filename · yq ...
🌐
Baeldung
baeldung.com › home › files › file editing › processing yaml content with yq
Processing YAML Content With yq | Baeldung on Linux
March 18, 2024 - $ yq 'to_entries' personal_data.yaml - key: name value: "My name" - key: surname value: "Foo" - key: street_address value: city: "My city" street: "My street" number: 1
🌐
GitHub
github.com › mikefarah › yq › issues › 1102
Selecting elements from map could be simplified · Issue #1102 · mikefarah/yq
February 10, 2022 - yq '.country |= with_entries(select(.key == "name" or .key == "capital"))' yaml · to output · country: name: Australia capital: Canberra · If it were a JSON, jq could do · yq -o=json yaml | jq '.country |= {name, capital}' { "country": { "name": "Australia", "capital": "Canberra" } } Or even use map_values ·
Author   inianv
Find elsewhere
🌐
MetaCPAN
metacpan.org › dist › ETL-Yertl › view › bin › yq
yq - Filter YAML through a command-line program - metacpan.org
)' - foo - baz $ yq 'keys' - foo - baz $ yq '{ k: keys( .foo ) }' k: - one - two - three ... Return a list of key/value pairs for the hash or array given by EXPRESSION.
🌐
GitHub
github.com › mikefarah › yq › issues › 287
How do I select multiple keys for output? · Issue #287 · mikefarah/yq
October 29, 2019 - This seems like a basic question but I can't find examples anywhere in the documentation. If I have input like - alpha: 1 beta: foo gamma: 0.3 delta: bar - alpha: 2 beta: baz gamma: 1.23 delta: buzz And I want to select only the beta and...
Author   ronniegane
🌐
yq
mikefarah.gitbook.io › yq › recipes
Recipes | yq - GitBook
Scalars, we just need the key and quoted value: ( select(kind == "scalar") | key + "='" + .
🌐
yq
mikefarah.gitbook.io › yq › operators › entries
Entries | yq - GitBook
July 23, 2025 - - key: 0 value: a - key: 1 value: b · Copy · null · Copy · yq 'to_entries' sample.yml · Copy · Copy · a: 1 b: 2 · Copy · yq 'to_entries | from_entries' sample.yml · Copy · a: 1 b: 2 · Copy · - a - b · Copy · yq 'to_entries | from_entries' sample.yml · Copy · 0: a 1: b · Copy · a: 1 b: 2 · Copy · yq 'with_entries(.key |= "KEY_" + .)' sample.yml · Copy · KEY_a: 1 KEY_b: 2 · Copy · a: 1 b: b_a: nested b_b: thing · Copy · yq '(.. | select(tag=="!!map")) |= with_entries(.key |= "KEY_" + .)' sample.yml ·
🌐
Thebottleneckdev
thebottleneckdev.com › blog › processing-yaml-files
YAML Processing with YQ: A Practical Guide | The Bottleneck Dev Blog
April 7, 2025 - # Order fields consistently for question files yq -i '... | select(has("type")) |= with_entries( select(.key == "type") + select(.key == "id") + select(.key == "problemStatement") + select(.key == "correctAnswer") )' questions.yaml ... # Convert all solution details to use the literal block style (|) yq -i 'eval(.. | select(has("solutionDetails")).solutionDetails) |= style("literal")' questions.yaml · This is incredibly useful for making educational content or documentation more readable. Finding and updating values deeply nested in YAML is a common need:
🌐
cheat.sh
cheat.sh › yq
cheat.sh/yq
For version 4, use 'yq_v4' # Read spec.template node from example.yml yq r example.yml spec.template # Read from stdin cat sample.yaml | yq r - b.c # Print the path yq r --printMode p "a.thing*.*" # Print the path and value yq r --printMode pv "a.thing*.*" # Print the length of a list yq r sample.yml --length animals # Read with conditions yq r sample.yml spec.metadata[name==myapp] # Collect results into an array yq r sample.yaml --collect a.*.animal # Read from the 2nd document yq r -d1 sample.yaml b.c # Validate a document
🌐
HackingNote
hackingnote.com › en › cheatsheets › jq
Cheatsheet - jq
Given a list (items[]), find the item according to .spec.foo, change the value of .spec.bar to baz: cat file.json | jq '(.items[] | select(.spec.foo == "key")).spec.bar |= "baz"' Selectors start with .. Functions do not. $ echo '{ "a": 1, "b": 2 }' | jq 'keys' # [a, b] keys: get keys of the objects.
🌐
Better Programming
betterprogramming.pub › my-yq-cheatsheet-34f2b672ee58
My Cheatsheet for the “yq” Tool. Parsing Kubernetes YAML with yq | by Stefanie Lai | Better Programming
August 8, 2022 - My Cheatsheet for the “yq” Tool Parsing Kubernetes YAML with yq yq is a tool that mainly focuses on YAML data processing and highlighting. Its current 4.x version has made a huge upgrade based on …