What Is the YAML to JSON Converter?
Convert between YAML and JSON in either direction. Nested maps, arrays, multi-line strings and anchors convert; YAML comments are dropped because JSON has no comment syntax.
Why Use This Tool?
YAML and JSON are both used for configuration and data interchange, but they have different strengths. This converter lets you switch between formats while preserving data structure and types.
How to Use This YAML JSON Converter
- Paste your YAML or JSON — Enter the data you want to convert into the input area.
- Select the direction — Choose YAML → JSON or JSON → YAML from the conversion toggle.
- Review the output — The converted output appears instantly with proper formatting and syntax highlighting.
- Copy the result — Click Copy to grab the converted data for your configuration files, API payloads, or documentation.
Worked example: the YAML values that change type
Most YAML-to-JSON surprises come from plain, unquoted values the parser has to guess a type for, and parsers don't all guess the same way. This tool uses js-yaml 4.1.0, which follows YAML 1.2's core schema. On October 12, 2026 we converted the same snippet with it and, for comparison, with PyYAML 6.0.3, which follows the older YAML 1.1 rules that many tools still use.
| YAML line | This tool (YAML 1.2) → JSON | PyYAML (YAML 1.1) |
|---|---|---|
country: NO | "NO" (string) | false |
flag: yes / switch: on | "yes" / "on" (strings) | true / true |
zip: 01234 | 1234 (number, leading zero lost) | 668 (read as octal) |
time: 12:30 | "12:30" | 750 (base-60: 12×60+30) |
version: 1.10 | 1.1 | 1.1 |
date: 2026-10-12 | "2026-10-12T00:00:00.000Z" | a date object |
big: 12345678901234567890 | 12345678901234567000 (precision lost) | exact |
empty: and tilde: ~ | null, null | null, null |
The rule of thumb: quote anything that must stay a string. That covers postal codes and IDs with leading zeros, version numbers, dates you want as text, and long numeric IDs: zip: "01234", version: "1.10". The "Norway problem" (NO becoming false) and the yes/no/on/off booleans are YAML 1.1 behaviours. This tool treats them as strings, but a 1.1 parser elsewhere in your pipeline (PyYAML's default loader, older CI systems) won't, so quoting protects you everywhere.
Converting JSON back to YAML, the tool quotes exactly these ambiguous strings for you (flag: 'yes', country: 'NO', zip: '01234', version: '1.10'), so a round trip through this tool keeps them as strings.
What doesn't survive YAML → JSON
Comments are dropped, because JSON has no comment syntax. Anchors and aliases (&base / *base) are expanded into full copies. Block strings (| and >) become ordinary JSON strings, with \n wherever the YAML keeps a line break. Integers beyond 2⁵³ lose precision, because JavaScript numbers can't hold them exactly.
Sources
Checked on .
Related tools
- For XML sources, hop to the XML to JSON converter first to get JSON, then continue here for YAML.
Frequently Asked Questions
📖 Learn More
Related Article How to Convert Between YAML & JSON →Built by Derek Giordano · Part of Ultimate Design Tools