JSON to YAML Converter
Paste JSON on the left and valid YAML appears on the right immediately. The conversion runs in your browser using JavaScript, so a config file containing API keys or connection strings never travels to a server.
- Free, no sign-up
- Runs in your browser
- Nothing uploaded
- Updated Sep 2026
At a glance
- Direction
- JSON → YAML (for the reverse, use the YAML to JSON converter)
- Processing
- Entirely client-side — nothing uploaded
- Indentation
- 2 or 4 spaces, your choice
- Handles
- Nested objects, arrays, multi-line strings, null, booleans, numbers
- Output
- YAML 1.2, compatible with every major parser
- Cost
- Free, no account, no rate limit
What this converter does
JSON and YAML describe the same thing — a tree of keys, values, lists and scalars — but they write it down differently. JSON uses braces, brackets and quotes; YAML uses indentation and far less punctuation. Because the underlying data model is nearly identical, converting from one to the other is lossless in practice, and this tool does that conversion in a single pass as you type.
What you get back is not a mechanical transcription. The converter makes the output
readable the way a person would write it: strings are left unquoted when quoting them
would add nothing, keys that could be misread as booleans or numbers are quoted so they
survive a round trip, and a string containing newlines becomes a block scalar
(|) rather than one long line full of \n escapes. That last
point is the single biggest reason people convert to YAML — a shell script or a
certificate embedded in JSON is unreadable, and in YAML it reads like the original file.
Everything happens in the browser tab. There is no upload step, no server round trip and no request in the network panel, which matters because the JSON people convert is very often a Kubernetes secret, a CI configuration or a credentials block.
When converting JSON to YAML is the right move
The conversion is usually driven by the tool that will read the file rather than by preference:
- Kubernetes manifests. The API returns JSON, but manifests are
written, reviewed and committed as YAML. Converting an object you pulled with
kubectl get -o jsongives you something you can actually put in a pull request. - CI/CD pipelines. GitHub Actions, GitLab CI and CircleCI all expect YAML. A pipeline definition generated by a script or an API is usually JSON first.
- Docker Compose. Compose files are YAML, and converting from JSON is the quickest way to turn programmatic output into something you can hand-edit.
- Configuration you want to comment. JSON has no comment syntax. Moving a config to YAML is often done purely so the team can explain why a value is what it is.
- OpenAPI and AsyncAPI specs. Both formats accept either, but YAML is what most teams keep in version control because the diffs are readable.
There is one case where you should not convert: if a file is only ever read by a machine and never edited by a person, JSON's stricter grammar is an advantage. YAML's flexibility is what makes it pleasant to write and also what makes it possible to write something ambiguous.
How JSON and YAML differ in practice
The differences that actually bite when you convert between them:
| Aspect | JSON | YAML |
|---|---|---|
| Comments | Not supported at all | # to end of line |
| Structure | Braces and brackets | Indentation (spaces only, never tabs) |
| Quoting | Every key and string quoted | Optional for most scalars |
| Multi-line strings | \n escapes in one long line | Block scalars with | or > |
| Trailing commas | Invalid | Not applicable |
| Duplicate keys | Last one wins, silently | An error in strict parsers |
| File size | Usually smaller | Usually larger but more readable |
One asymmetry is worth knowing about. Every valid JSON document is also valid YAML, because YAML 1.2 was deliberately defined as a superset of JSON. The reverse is not true: plenty of YAML has no JSON equivalent, including comments, anchors and multiple documents in one file. So JSON to YAML always succeeds, while YAML to JSON can legitimately fail.
The quoting traps this converter avoids
YAML's convenience comes from guessing what you meant, and the guesses occasionally
go wrong. The classic example is the so-called Norway problem: in YAML 1.1, the unquoted
value no parses as the boolean false, so a country list
containing Norway's NO code silently becomes false. Related
traps include yes, on, off, and version numbers
like 1.10 which parse as the float 1.1.
This converter quotes any scalar that a parser could reinterpret — reserved words, anything that looks numeric, strings with leading or trailing whitespace, and strings starting with a character that has structural meaning. The result is slightly more quoting than a minimal encoder would emit, and output that survives a round trip through any parser without changing meaning. If you want to confirm that, run the result back through the YAML to JSON converter and compare.
How to use the JSON to YAML Converter
-
Paste or upload your JSON
Paste into the left pane, or use Upload file to load a
.jsonfile from your machine. The file is read in the browser, not sent anywhere. -
Pick your indentation
Two spaces is the common default and what Kubernetes, GitHub Actions and Docker Compose examples use. Choose four if your team's style guide calls for it.
-
Check the status line
If the JSON has a syntax error, the status bar names the line and column rather than just refusing. Fix it and the output updates as you type.
-
Copy or download the YAML
Use Copy output for pasting into an editor, or Download to save it as a
.yamlfile.
Frequently asked questions
Is my JSON uploaded to a server?
No. The conversion is JavaScript running in your browser tab. If you open your browser's network panel while converting, you will see no request. That is deliberate — the JSON people convert is frequently a Kubernetes secret or a credentials block.
Does converting JSON to YAML lose any data?
No. YAML 1.2 is a strict superset of JSON, so every JSON value has an exact YAML representation. Formatting changes — quotes disappear, indentation replaces braces — but the parsed data is identical. You can verify this by converting the output back with the YAML to JSON converter.
Should I use 2 or 4 spaces for indentation?
Two is the de facto standard: Kubernetes, Docker Compose, GitHub Actions and most published YAML examples use it, and nesting gets deep quickly so the narrower indent keeps lines short. Four is easier to scan in shallow files. What matters far more is consistency, and never using tabs — YAML rejects tab characters for indentation entirely.
Why does the output quote some strings but not others?
Because some strings change meaning if left bare. no, yes, on and off parse as booleans in many parsers, and 1.10 parses as the number 1.1. The converter quotes anything a parser could reinterpret and leaves everything else clean, so the output reads well and still round-trips exactly.
Can it handle large files?
Files up to about 8 MB convert comfortably. Beyond that the browser tab starts to struggle with rendering rather than parsing, and a command-line tool is the better choice.
How do I add comments to the result?
Add them by hand after converting, using #. Comments cannot survive the conversion itself because JSON has no comment syntax, so there is nothing in the source to carry across.