Transform YAML into JSON for downstream tools.

Section: Read and query YAML with yq

Convert YAML to JSON

bash
bash
yq -o=json '.' config.yaml
Explanation

Helpful when piping YAML into tools that only understand JSON.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Read and query YAML with yq
Read a nested field
Print a nested value from YAML.
OpenIn sheetbashsame section
Read a list
Print array items from a YAML path.
OpenIn sheetbashsame section
Filter objects in a sequence
Select matching records from a YAML array.
OpenIn sheetbashsame section
Set an image tag
Update a nested container image value in place.
OpenIn sheetbash1 tag match
Append to a YAML array
Add a value to a sequence in place.
OpenIn sheetbash1 tag match
Delete a key
Remove an unwanted field from YAML.
OpenIn sheetbash1 tag match