What does this tool do?
This is a free online YAML to JSON converter. Paste a YAML document on the left and the equivalent JSON appears on the right as you type. Flip the direction toggle and it works the other way too — JSON to YAML. Because both YAML and JSON describe the same underlying data model (maps, lists, strings, numbers, booleans and null), converting between them is lossless for the data itself.
The conversion runs entirely in your browser. Nothing you paste is sent to a server, so it is safe to use with config files, secrets templates, or anything you would not want to upload. It also means it keeps working offline once the page has loaded.
How to convert YAML to JSON
- Paste or type your YAML into the left box. Conversion happens live.
- The JSON result shows on the right. Use the Indent dropdown to switch between 2 spaces, 4 spaces, or tabs.
- Click Copy to put the result on your clipboard, or Download to save a
.jsonfile. - If your YAML has a syntax error, a red message shows exactly what went wrong and where.
- Press Sample any time to load an example you can edit.
YAML to JSON conversion rules (and gotchas)
A few things are worth knowing so the output never surprises you:
- Comments are dropped. JSON has no comment syntax, so every
# commentline in your YAML disappears. The actual data is preserved exactly. - Types are inferred the YAML way.
true/falsebecome JSON booleans,null(or an empty value) becomesnull, and unquoted numbers become JSON numbers. Wrap a value in quotes in your YAML if you want it to stay a string (for example a ZIP code or a version like"1.0"). - Anchors and aliases are expanded. If your YAML uses
&anchorand*aliasto reuse a block, the JSON output writes the value out in full at each place it is referenced. - Indentation defines structure. YAML uses spaces (never tabs) for nesting, so a stray tab is the most common cause of a parse error.
JSON to YAML
Going the other way, this tool produces clean, block-style YAML: two-space indentation, no unnecessary quoting, and arrays as dash lists. That makes it handy for turning an API response or a package.json snippet into a Kubernetes manifest, a GitHub Actions workflow, or a docker-compose file — formats that are far more pleasant to read and edit as YAML.
YAML vs JSON — which should you use?
JSON is the lingua franca of web APIs: strict, unambiguous, and supported everywhere. It is great for machines but noisy for humans because of all the braces and quotes. YAML is a superset of JSON designed for humans — it drops the punctuation, allows comments, and reads top-to-bottom like an outline. That is why configuration files (Kubernetes, Ansible, CI pipelines, docker-compose) overwhelmingly use YAML, while data sent over the wire uses JSON. Converting between them lets each side of your workflow use the format that fits.
Common uses
- Turn a Kubernetes or docker-compose YAML manifest into JSON to feed an API or a script.
- Convert a JSON API response into YAML for a readable config file or fixture.
- Validate YAML — if it converts without an error, it is syntactically valid.
- Re-indent or reformat a messy file by round-tripping it through the converter.
FAQ
Is this YAML to JSON converter free?
Yes. It is completely free, needs no account, and runs entirely in your browser. Your data is never uploaded to a server.
Is my data safe?
Yes. All conversion happens locally in your browser with JavaScript. Nothing you paste leaves your device, so it is safe for sensitive config files.
Does converting YAML to JSON keep my comments?
No. JSON has no concept of comments, so YAML comment lines (starting with #) are dropped. The data itself is preserved exactly.
Why do I get a parse error?
The most common causes are using a tab for indentation (YAML requires spaces), inconsistent indentation, or a missing colon/quote. The red error message points to the line.
Can I convert JSON back to YAML?
Yes — switch the toggle to JSON → YAML, paste valid JSON, and you get clean YAML out.
Is there a size limit?
There is no fixed limit; you are only bounded by your browser's memory since everything runs locally. Very large files (tens of MB) may feel slow.