YAML Config and API Patterns/Convert JSON to YAML with yq

Convert JSON input into YAML from the shell.

Section: Conversion and interoperability

Convert JSON to YAML with yq

bash
bash
yq -P -p=json '.' config.json
Explanation

Useful in scripts and format conversion pipelines.

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 Conversion and interoperability
Convert JSON to YAML with Python
Transform JSON into YAML output for config workflows.
OpenIn sheetbashsame section
Convert Compose to resolved output
Render final service configuration from a YAML Compose file.
OpenIn sheetbashsame section
Build layered Kubernetes YAML
Generate final Kubernetes YAML from base and overlays.
OpenIn sheetbashsame section
App config example
Structure app settings in a readable YAML document.
OpenIn sheetyaml1 tag match
Environment-specific config
Model different settings by environment.
OpenIn sheetyaml1 tag match
OpenAPI YAML snippet
Show how YAML appears in API documentation.
OpenIn sheetyaml1 tag match