JSON1 / JSON to YAML
JSON to YAML
Convert JSON to YAML. Strings that would otherwise read as booleans, numbers, or nulls are quoted so the result parses back to the same value.
Converted output appears here as you type.
About this tool
YAML expresses the same data as JSON but leans on indentation instead of braces, which makes it the usual choice for configuration a person has to read and edit. Every JSON document converts, because JSON is a subset of YAML — the interesting part is not the structure, it is the quoting.
YAML infers a type from unquoted text, and it infers generously. Most loaders in use today — PyYAML, Go's yaml.v2, Ruby's Psych — implement YAML 1.1, where all of the following are typed values rather than strings:
NOA boolean, in any capitalisation, along with yes, on, and off. This is the Norway problem: the country code NO loads as false.0x1AThe number 26. Octal (017), binary (0b101), and underscore-separated digits (1_000) resolve too..infA float, as are .nan, .5, and +5 — none of which look like decimals in the way a JSON number does.1:30Sexagesimal: 90. A duration or a fragment of a timestamp becomes an integer nobody expects.2026-08-04A date object, not the string you wrote. So is anything with a time appended.
Every one of those is quoted on the way out, keys as well as values, so what you load is what you converted. Strings that are unambiguous are left bare, because a file where every scalar is quoted is a file nobody wants to edit.
- Why did some of my strings come back quoted and others not?
- Only the ambiguous ones.
name: Adacannot be read as anything but a string, so quotes would be noise;version: "1.0"needs them or YAML gives you the number 1. The test for this converter checks each trap against a real YAML loader rather than against its own reader, because the point is surviving the parser at the other end. - Does the quoting cost me anything?
- Only characters. A quoted scalar and a bare one parse to the same string, so nothing downstream behaves differently — and a config file that reads back the values you put in is worth a few quote marks.
- Are the indentation and key order stable?
- Yes. Nested mappings indent by two spaces, sequences sit at the parent key's level, and keys keep the order they had in the JSON. Convert twice and you get the same bytes, so the output is worth committing and diffing.
- What about a JSON null?
- It becomes a bare
null. YAML also spells this~and treats an empty value as null, butnullis the spelling every loader agrees on and the only one that reads unambiguously.
Related tools
- YAML to JSONConvert YAML to formatted JSON. Handles nested mappings, block and inline sequences, quoted scalars, and comments.
- JSON to XMLConvert JSON to indented XML. Arrays repeat the parent tag, nulls become xsi:nil, and keys that are not legal element names are sanitised.
- CSV to JSONConvert CSV to a JSON array of objects. Quoted fields, escaped quotes, and embedded newlines are parsed correctly, and numbers and booleans are typed.
Read the guide for the edge cases this converter cannot decide for you.