How to use the YAML to JSON
- Paste YAML into the YAML pane, open a
.yaml/.ymlfile, or click Load sample. - The JSON appears instantly. Choose 2-space, 4-space or tab indentation for the JSON output.
- If the YAML is invalid, the error message shows the line and column and highlights the spot.
- Click Copy or Download to save
data.json.
What is YAML to JSON conversion?
YAML is designed for humans: indentation instead of braces, optional quotes and comments. JSON is designed for machines and APIs. Converting YAML to JSON lets you feed a config file to a tool or API that only speaks JSON, validate it against a JSON Schema, or simply check how a YAML parser actually interprets your indentation — which is the fastest way to find out why a value ended up in the wrong place.
What the converter supports
- Anchors, aliases and merge keys —
&defaults,*defaultsand<<: *defaults(common in Docker Compose and GitLab CI) are expanded into plain JSON. - Multiple documents — files with several documents separated by
---(typical for Kubernetes) become a JSON array, one element per document. - Block scalars —
|keeps line breaks,>folds them into spaces. - Comments are allowed in YAML but dropped in JSON, which has no comment syntax.
How values are typed (YAML 1.2)
The parser follows the YAML 1.2 core schema, the same rules as modern tools. Plain scalars become JSON types like this:
| YAML | JSON | Note |
|---|---|---|
true, False | true, false | Booleans |
yes, on, NO | "yes", "on", "NO" | Strings in YAML 1.2 (booleans in old 1.1 parsers) |
~, null, empty value | null | |
0x1F, 0o17, 1e3 | 31, 15, 1000 | Numbers |
2024-05-01 | "2024-05-01" | Kept as a string |
.inf, .nan | null | JSON has no infinity/NaN |
Common YAML errors
Tabs for indentation are forbidden — use spaces. Inconsistent indentation (“bad indentation of a mapping entry”) happens when sibling keys don't line up. Unquoted colons — title: Note: read me — confuse the parser; wrap the value in quotes. Duplicate keys in the same mapping are reported as errors. Once converted, you can tidy the result with the JSON Formatter or generate types with JSON to TypeScript. For the reverse direction use JSON to YAML.
Tools that pair well with the YAML to JSON
- CSV to JSON — Paste CSV or TSV and get a JSON array of objects.
- JSON to CSV — Turn a JSON array into a spreadsheet-ready CSV.
- JSON to Markdown Table — Turn API responses or LLM-generated JSON arrays into a clean, aligned Markdown table for READMEs, docs and pull requests.
Frequently asked questions
Does it support Docker Compose and Kubernetes files?
<< merge keys are resolved, and multi-document Kubernetes files separated by --- are returned as a JSON array.Why is "yes" converted to a string and not true?
true/false (in any capitalisation) are booleans. yes, no, on and off were booleans in YAML 1.1, which caused many bugs, so modern parsers treat them as strings.