JSON ↔ YAML
Bidirectional converter between JSON and YAML formats
Shortcuts: Ctrl+Enter run · Ctrl+L clear · Ctrl+D download
About JSON ↔ YAML
This tool converts between JSON and YAML in both directions. YAML is widely used in configuration files (Docker Compose, Kubernetes, GitHub Actions, Ansible) because it is more human-readable than JSON. Paste JSON to get clean YAML, or paste YAML to get valid JSON — useful when switching between config formats or debugging infrastructure files.
- ✓Bidirectional conversion — JSON to YAML and YAML to JSON
- ✓Produces idiomatic YAML with proper indentation and block style
- ✓Handles anchors, aliases, and multi-line strings in YAML input
- ✓One-click copy and download of the converted output
JSON and YAML — Same Data, Different Syntax
YAML was designed to be a more human-friendly superset of JSON's data model — every JSON document is technically valid YAML, but YAML adds syntax that makes hand-written configuration files much easier to read and write. Converting between the two is mostly mechanical, but a few details trip people up.
The same data, two ways
# JSON
{
"service": "api",
"replicas": 3,
"env": ["production"],
"resources": { "cpu": "500m", "memory": "256Mi" }
}
# Equivalent YAML — block style, no braces or commas
service: api
replicas: 3
env:
- production
resources:
cpu: 500m
memory: 256MiYAML's block style removes the visual noise of braces, brackets, and trailing commas — which is exactly why it became the default format for tools like Docker Compose, Kubernetes, GitHub Actions, and Ansible, where humans frequently hand-edit configuration.
Where YAML shows up in everyday development
- ·Kubernetes manifests and Helm charts — deployments, services, and config maps are written in YAML
- ·CI/CD pipelines — GitHub Actions workflows, GitLab CI, and CircleCI configs all use YAML
- ·Docker Compose files — service definitions, networks, and volumes
- ·Application configuration — many frameworks (Spring Boot, Symfony, Ansible) read YAML config files alongside or instead of JSON
Type ambiguity — the trickiest part of conversion
- ·YAML's parser tries to infer types from unquoted scalars — `yes`, `no`, `on`, `off`, `true`, `null`, and bare numbers can all be interpreted as non-string types depending on the YAML version and parser
- ·A JSON string like `"yes"` must be quoted in the YAML output (`"yes"` or `'yes'`) — otherwise some YAML parsers will read it back as the boolean `true`, silently changing its type
- ·Similarly, a string that looks like a number (`"007"`, `"1.0"`) needs quotes in YAML to avoid being parsed as a numeric type on the way back to JSON
Tip: This is exactly why the converter adds quotes around certain values even though your original JSON didn't have them — it is preserving the type, not being inconsistent. If you round-trip JSON → YAML → JSON, the quoting ensures you get the same types back.
Features that don't survive the round trip
- ·Comments — YAML supports `#` comments; JSON has no comment syntax, so converting YAML to JSON drops them
- ·Anchors and aliases (`&name` / `*name`) — YAML's mechanism for reusing blocks of config has no JSON equivalent; converting to JSON expands them into duplicated, fully-resolved data
- ·Multi-line string styles (`|` literal blocks, `>` folded blocks) — these become plain JSON strings with the line breaks preserved as `\n` characters