Tip: Press Ctrl+Enter to convert
YAML ↔ JSON Converter
Paste YAML or JSON — the tool auto-detects which format you gave it and converts to the other. Everything runs in your browser using the js-yaml library. Nothing is sent to a server, so it's safe to paste config files with secrets.
What this tool does
The YAML ↔ JSON Converter takes any valid YAML or JSON and converts it to the other format. It auto-detects
which format you pasted — JSON starts with { or [, YAML is anything else.
The conversion is lossless for most real-world config data: strings, numbers, booleans, nulls, arrays, and objects
all round-trip correctly. YAML anchors and aliases are resolved before conversion.
How to use it
- Paste your YAML or JSON into the left pane.
- The output updates automatically. Click Convert or press Ctrl+Enter to force a re-parse.
- Use the indent toggle to control JSON output indentation (2 spaces, 4 spaces, or tabs).
- Click Swap to move the output back to the input — useful for chaining conversions.
- Click Copy to copy the output to clipboard.
When to use this tool
- Kubernetes / Helm configs — Kubernetes uses YAML natively, but many tools output JSON. Convert between them when writing or debugging manifests.
- CI/CD pipelines — GitHub Actions uses YAML; many APIs return JSON. Paste a pipeline fragment to verify structure.
- API development — Some API frameworks (like FastAPI) generate JSON schemas. Convert to YAML for OpenAPI spec files.
- Docker Compose — Docker Compose files are YAML. Convert to JSON if your tooling expects it, or vice versa.
- Ansible playbooks — Ansible uses YAML. Compare against JSON output from
ansible-inventory --list.
Conversion limits
YAML is a superset of JSON, which means all valid JSON is also valid YAML — but not all valid YAML converts to JSON cleanly.
Specifically: YAML supports multi-document streams (multiple --- separated documents in one file) and complex key types
like objects as map keys. These don't have JSON equivalents. This tool converts the first document only if you paste a multi-document stream.
Simple config files, Kubernetes manifests, Docker Compose, and CI pipeline files convert without any issues.
Frequently Asked Questions
Why does my YAML boolean become a string in JSON?
YAML recognizes yes, no, on, off as booleans in YAML 1.1 (the version most parsers use). When converted to JSON, they become true or false. If you see unexpected boolean coercions, quote your values: value: "yes" treats it as a string in both formats.
Does this tool send my data anywhere?
No. The conversion runs entirely in your browser using js-yaml loaded from a CDN. Your YAML or JSON is never transmitted to any server. It's safe to paste config files that contain secrets, API keys, or passwords.
What happens to YAML comments?
JSON has no comment syntax, so YAML comments are dropped during YAML-to-JSON conversion. This is expected — comments are metadata for humans, not data. Going JSON-to-YAML also produces no comments since the source JSON cannot express them.
Can I convert JSON Schema to YAML?
Yes. JSON Schema is standard JSON and converts directly to YAML. The resulting YAML is valid and can be used in OpenAPI spec files, which accept YAML format. Paste your JSON Schema into the left pane and the YAML equivalent appears on the right.
Want the full explanation? Read the guide: YAML vs JSON: The Real Differences and When to Use Each →