YAML to JSON Converter (and JSON to YAML)
YAML and JSON are two text formats for the same thing: structured data made of keys, values, lists, and nested groups. JSON uses braces, brackets, and quotes; YAML uses indentation and dashes. The converter below translates between them entirely in your browser, so you can move a config file from one format to the other without installing anything or uploading your data.
What YAML and JSON Are and How They Relate
JSON, short for JavaScript Object Notation, is the data format that web APIs use to send and receive structured data. It marks objects with curly braces, arrays with square brackets, and wraps every string in double quotes. YAML, which stands for YAML Ain’t Markup Language, describes the same model of objects, arrays, and scalar values, but it leans on line breaks and indentation instead of punctuation. Because both formats map onto the same underlying structure, any JSON document can be written as YAML and most YAML documents can be written as JSON. That shared model is what makes conversion between them straightforward.
How to Use It
- Choose a direction: YAML to JSON, or JSON to YAML.
- Paste your source text into the box. Whole files work, not just snippets.
- Read the converted output in the result box below the tool.
- Copy the output and save it with the matching extension: .json, or .yaml and .yml.
- If you see a parse error, check the source for the issue the message points to, then convert again.
YAML vs JSON Syntax Side by Side
| Element | JSON | YAML |
|---|---|---|
| Key and value | “name”: “Example” | name: Example |
| Nesting | Curly braces { } | Two-space indentation |
| List | [ “a”, “b” ] | – a (one item per line) |
| Strings | Always double-quoted | Quotes optional |
| Comments | Not allowed | Start a line with # |
| Boolean and null | true, false, null | true, false, null |
Supported vs Unsupported YAML Features
This converter handles the common subset of YAML that covers the great majority of config files: indentation-based mappings, nested maps, sequences written with a leading dash, and scalar values such as strings, numbers, booleans, and null. It also skips blank lines and comments, and accepts optional quotes around strings. It does not fully support the advanced parts of the YAML specification, including anchors and aliases, multi-line block scalars, flow-style collections written inline, and multiple documents in one file. For those cases, use a full YAML library in your language of choice. JSON, by contrast, is a smaller and stricter format, so JSON to YAML conversion is complete.
When to Use Each
A program reads or writes the data: API requests and responses, browser storage, and anything a machine parses. JSON is unambiguous and supported everywhere, which makes it the safe default for data exchange.
A person edits the file by hand: application config, CI pipelines, and infrastructure definitions. YAML allows comments and reads with less punctuation, which makes long configuration files easier to scan and maintain.
Your Data Stays in Your Browser
The conversion runs as JavaScript on your own device. Nothing you paste is uploaded, logged, or stored on any server, so it is safe to convert config files that contain hostnames, paths, or other internal details. You can confirm this by disconnecting from the internet and watching the converter still work.
Last Thoughts on Converting YAML and JSON
YAML and JSON are not rivals; they are two views of the same data. JSON is the format machines exchange, and YAML is the format people edit. Converting between them is mostly a matter of swapping punctuation for indentation and back, which is exactly what this tool does for the common subset of YAML that real config files use.
Convert your next config file above, and for related work see our JSON formatter to clean up the output, the JSON to CSV converter for tabular data, and the XML formatter for a third common format. Explore the rest of our free online tools.
Key Takeaways:
- YAML and JSON describe the same data model, so converting between them maps keys, values, and lists one to one.
- JSON uses braces, brackets, and quotes; YAML uses two-space indentation and dashes.
- YAML is indentation-sensitive: use spaces, never tabs, and keep two spaces per level.
- Use JSON for machine data exchange and YAML for human-edited config files.
- This converter supports the common YAML subset; anchors, multi-line blocks, and flow style are not fully supported.
- Conversion happens entirely in your browser, so nothing you paste is sent anywhere.
Frequently Asked Questions (FAQs)
How do I convert YAML to JSON?
Paste your YAML into the tool, keep the direction set to YAML to JSON, and read the JSON output below. The converter reads the indentation and dashes in your YAML and rewrites the same structure with the braces, brackets, and quotes that JSON requires.
Can I convert JSON back to YAML?
Yes. Switch the direction to JSON to YAML and paste valid JSON. Because JSON is a stricter and smaller format, every JSON document maps cleanly to YAML, so this direction is fully supported.
Why does my YAML fail to convert?
The most common cause is indentation. YAML requires spaces, not tabs, and a consistent two spaces per level. A stray tab, an uneven indent, or a missing colon will produce a parse error. Check the line the message points to and fix the spacing.
Which YAML features are not supported?
This tool handles the common subset used by most config files: mappings, nested maps, sequences, scalars, and comments. It does not fully support anchors and aliases, multi-line block scalars, inline flow style, or multiple documents in one file. For those, use a full YAML library.
Is my data sent to a server?
No. The conversion runs in your browser using JavaScript, and nothing you paste is uploaded, logged, or stored anywhere. It is safe to convert config files that contain internal hostnames or paths.
Should I use YAML or JSON for my config?
Use YAML when people edit the file by hand, since it allows comments and reads with less punctuation. Use JSON when a program reads or writes the data, since it is unambiguous and supported everywhere. Many teams keep config in YAML and convert to JSON when a tool needs it.


