Three things in one place: YAML to JSON, JSON to YAML, and format YAML, which reads a file and writes it back in one consistent style. Every conversion is also a validation: a YAML error is reported with its line and column and a button that puts the cursor on it. The parser is written for this site and runs in your browser, so configuration files with secrets in them never leave your device.
What YAML it understands
The common YAML 1.2 subset that configuration files use: nested mappings and lists (including the - key: value style and lists written at the same indentation as their key), inline [a, b] and {a: 1} collections, plain, 'single' and "double" quoted strings with every escape, literal | and folded > blocks with the - and + chomping indicators, anchors (&name), aliases (*name), the << merge key, the standard tags (!!str, !!int, !!float, !!bool, !!null) and several documents separated by ---. Several documents become a JSON array with one item per document.
Not supported, and reported as an error rather than guessed: complex keys (? key or a list used as a key), custom tags such as !Ref from CloudFormation, and %TAG directives. Comments are dropped, because JSON has no comments.
The parser follows the YAML 1.2 core schema: true and false are booleans, ~ and null are null, numbers are numbers, and everything else is a string. It is checked against the examples in chapter 2 of the YAML 1.2.2 specification and against an independent YAML library on dozens of edge cases.
The YAML 1.1 traps it warns about
Many tools still read YAML with 1.1 rules (PyYAML, older Ruby and Go libraries, some CI systems). The two versions disagree on values people write every day:
- `NO`, `yes`, `on`, `off`, `y`, `n` are strings in YAML 1.2 but booleans in YAML 1.1. A list of country codes containing Norway turns into
false (the "Norway problem"). - `0755` is the decimal number 755 in YAML 1.2 but octal 493 in YAML 1.1. File modes are the classic victim.
- `1:20` was a base-60 number (80) in YAML 1.1 and is a string in 1.2.
The tool warns with the line number whenever your file contains one of these, and the JSON to YAML direction always quotes such strings ("NO", "0755", "12:30", "2024-01-02") so the result means the same thing to every parser.
Converting safely
- Paste YAML (or open a .yaml/.yml file) and read the JSON. If the numbers or booleans are not what you meant, quote the values in the YAML.
- Read the warnings. A warning means the file is valid but another tool may read it differently.
- For JSON to YAML, choose 2 or 4 spaces and whether lists sit under their key; the output is plain block YAML that any parser reads the same way.
- Exact values are kept: key order is preserved and a 20-digit number is not rounded.
.inf and .nan have no JSON form and become null, with a note saying how many.
Tabs are not allowed for indentation in YAML, which is the most common error after a copy and paste; the error message names the line. Anchors are expanded in the JSON, and a document that expands to an absurd size (the "billion laughs" attack) is stopped instead of freezing the tab. For more on indentation, anchors and safe quoting, read YAML pitfalls and how to convert safely. To check the JSON side, use the JSON formatter.