Convert YAML and JSON both ways, and validate as you type
YAML is the usual format for configuration files: the services of an app, a continuous integration pipeline, server settings, translation files. JSON is what APIs and most programs expect. This tool converts one into the other, works as a YAML validator and a YAML formatter, and points to each error by line and column. Everything runs in your browser; your text is never uploaded.
How to use it
- Pick a conversion: “YAML → JSON”, “JSON → YAML” or “Format YAML” (a clean rewrite of the same file).
- Paste your text, click “Open a file” or try “Example”.
- Set the “JSON indentation” (2 spaces, 4 spaces, tab or “Compact (one line)”) or the “YAML indentation” (2 or 4 spaces).
- Read the status: “Valid YAML.”, a list of warnings, or the error with a highlighted excerpt and a “Go to the error” button.
- Switch to “Tree” to browse the data, then “Copy” or “Download”.
YAML vs JSON, side by side
Both formats hold the same data. YAML uses indentation where JSON uses braces, brackets and quotes.
| YAML | JSON result |
|---|---|
service: web | "service": "web" |
replicas: 2 | "replicas": 2 |
debug: false | "debug": false |
ports: then - "8080:80" | "ports": ["8080:80"] |
With “Compact (one line)”, those lines fit on a single JSON line of 64 characters, without a single space. Going from JSON to YAML, the tool writes block style and adds quotes only where they are needed.
Core YAML syntax rules
- A key is followed by a colon and a space:
name: value. - Nesting is done with indentation, using spaces only.
- A list item starts with a dash and a space:
- value. |keeps the line breaks of a text block,>folds them into spaces;-drops the final line break,+keeps every trailing blank line.&namesets an anchor,*namereuses it and<<: *namemerges an object;---separates documents, which the JSON output gathers into an array.- A comment starts with a space and then
#.
Common errors and traps
Tabs are not allowed in indentation: a: followed by a line starting with a tab is reported at line 2, column 1. A line shifted by one space breaks the structure. A value holding a colon and a space, such as title: Note: important, is rejected at column 12; write title: "Note: important" instead.
The best-known trap is the “Norway problem”: in YAML 1.1, country: NO turns into the boolean false, and so do yes, no, on and off. This tool follows YAML 1.2, the current version, where only true and false are booleans, so NO stays the text “NO”. Because many programs still read YAML 1.1, a warning asks you to quote such values. Other warnings cover duplicate keys (the last value wins) and misleading numbers: the ZIP code zip: 02134 becomes 2134 (and 1116 for a YAML 1.1 reader, which sees an octal), and version: 3.10 becomes 3.1.
Security
Never load YAML from an untrusted source with a loader that can build programming-language objects from tags; always use the “safe” loader of your language. Here, non-standard tags are only reported and never run, and aliases that would add more than 1,000,000 nodes (the “billion laughs” attack) stop the reading.
Frequently asked questions
Do comments make it into the JSON?
No, JSON has no comments. “Format YAML” does not keep them either, and it replaces each alias with its content.
Why is "3.10" quoted in the YAML output?
Without quotes, 3.10 would be read as the number 3.1. The tool quotes every string that looks like a number, a boolean or null.
Are very large integers kept exactly?
Yes. 12345678901234567890 is copied digit for digit, without the rounding browsers usually apply.
How large can the file be?
Up to 20 MB. The analysis runs in the background, so the page stays responsive.