Transform JSON into YAML output for config workflows.
Section: Conversion and interoperability
Convert JSON to YAML with Python
bash
bash
python - <<'PY'
import json, yaml, sys
print(yaml.safe_dump(json.load(open('config.json')), sort_keys=False))
PYExplanation
Helpful when migrating configs or producing more human-readable output.
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 yq
Convert JSON input into YAML from the shell.
Convert Compose to resolved output
Render final service configuration from a YAML Compose file.
Build layered Kubernetes YAML
Generate final Kubernetes YAML from base and overlays.