JSON to YAML Converter
Rewrite a JSON document as YAML — the same data, in the format configuration files actually use.
Your data stays on your device
Input — JSON
- characters
- 0
- lines
- 0
- size
- 0 B
Output — YAML
- characters
- 0
- lines
- 0
- size
- 0 B
Options
About this tool
YAML is a superset of JSON, which makes this direction the easy one: every JSON document has a valid YAML representation. What changes is the syntax — indentation instead of braces, dashes instead of brackets, and unquoted scalars wherever quoting is unnecessary.
The converter quotes strings only when required. Values that would otherwise be misread as booleans, numbers, dates or null are quoted automatically, which prevents the classic YAML surprise where the country code NO becomes the boolean false.
How to use this tool
- Paste JSON into the input panel or upload a file.
- Choose the indent width — two spaces matches most Kubernetes and CI conventions.
- Press Convert to produce YAML.
- Copy the output or download it as a .yaml file.
Key features
- Configurable indentation width
- Automatic quoting only where YAML would otherwise misinterpret a value
- Multi-line strings emitted as block scalars for readability
- Configurable line width for long values
- Comment header option noting the source of the document
- Copy and download as .yaml
Example
Input — JSON
{"name":"api","replicas":3,"ports":[80,443],"env":{"LOG":"debug"}}Output — YAML
name: api
replicas: 3
ports:
- 80
- 443
env:
LOG: debugGood to know
- JSON carries no comments, so the generated YAML has none beyond the optional header.
- YAML anchors and aliases are not generated; repeated structures are written out in full.
- Key order follows the JSON document; YAML does not impose an order of its own.
Frequently asked questions
Is YAML really a superset of JSON?
For YAML 1.2, yes in practice — a valid JSON document is valid YAML. The reverse is not true, since YAML adds comments, anchors, multiple documents and unquoted scalars.
Why are some of my strings quoted and others not?
Quoting is applied where it changes meaning. Values such as yes, no, true, null, 1.0 or 2024-01-01 would be parsed as non-strings if left bare, so they are quoted to preserve the original type.
Which indent width should I use?
Two spaces is the de facto standard for Kubernetes manifests, Docker Compose files and GitHub Actions workflows. YAML forbids tabs for indentation entirely.
How are long strings handled?
Strings containing newlines are emitted as block scalars, which keeps them readable instead of collapsing them into one escaped line.
Your data stays on your device
Your data is processed locally in your browser and is not uploaded to our server. This page keeps working after you go offline, because there is nothing to send.