How to use this JSON to YAML Converter
Paste your JSON into the input box, convert it to YAML, then copy or download the result.
The tool checks your JSON syntax during conversion and shows an error if the input is not
valid.
- Paste a JSON object or array into the input area.
- Click Convert to YAML.
- Review the YAML output in the result box.
- Copy the output or download it as a YAML file.
Example input
Common use cases
- Configuration file creation
- DevOps and deployment workflows
- Structured data conversion
- API response transformation
- Readable config editing
A superset conversion that can still change your data
YAML is a superset of JSON — every JSON document is already valid YAML — so this direction
looks like the easy one. The trap is on the way back out. YAML infers a scalar's type from
how it is written, so a JSON string can turn into YAML that a later reader treats
as a boolean, number, or null. The country code for Norway is the famous casualty: the JSON
"NO" written unquoted in YAML is read as the boolean false by a
YAML 1.1 parser. This is the "Norway problem."
The same fate awaits "yes", "no", "on",
"off", a version like "1.0" (becomes the number 1), a zip code
"01234", and "null". A careful converter quotes any string that
would be re-typed; a naive one emits it bare, and your JSON no longer round-trips through
YAML unchanged. When it matters, check that risky string values came out quoted.
Which YAML version will read the output matters
There is no one "YAML" behaviour. YAML 1.1's implicit typing treats yes,
no, on, off and octal-looking numbers as non-strings;
YAML 1.2's core schema narrowed booleans down to just true and
false. Crucially, the parser that reads your file decides which rules apply —
Python's widely used PyYAML still follows 1.1, while many JavaScript loaders default closer
to 1.2.
So the same converted YAML can parse to different data depending on where it lands. If your
config is consumed by a Python tool, assume 1.1 rules and quote defensively. Quoting a
string is never wrong in YAML, so it is the safe habit whenever a value could be mistaken
for something else.
The values most likely to need quotes
Beyond the boolean words, several string patterns get silently reinterpreted when left
unquoted. Leading-zero strings such as 0755 may be read as octal, and
08 or 09 can even error because 8 and 9 are not valid octal
digits. A tilde ~ alone means null. Values with a leading @ or
backtick are reserved. Anything that looks like a number but should stay text — phone
numbers, IDs, product codes — needs quoting to survive as a string.
What YAML expresses that JSON cannot
Converting from JSON produces plain YAML, but YAML has features JSON lacks that you may
want to add by hand afterwards: comments (#), anchors and aliases to reuse a
block, and readable multi-line block scalars for long text. One rule bites newcomers
immediately, though — YAML indentation must use spaces. A tab character in
indentation is a syntax error, which is why a config pasted from an editor that inserts
tabs refuses to parse even when it looks perfectly aligned.
Frequently Asked Questions
Why might my YAML not convert back to the same JSON?
Because YAML infers types from how a value is written. A JSON string like
"no" or "1.0", if emitted unquoted, is read back as a boolean
or a number by many parsers. The data changed type, not just format — the Norway
problem in miniature.
Which string values should I keep quoted?
Anything that could be mistaken for another type: yes, no,
on, off, true, false, leading-zero
codes like 01234, version strings like 1.0, and a lone
~ (which means null). Quoting is never wrong in YAML, so quote when in
doubt.
Does the YAML behave the same everywhere?
Not necessarily. YAML 1.1 parsers such as PyYAML treat yes/no/on/off as
booleans, while YAML 1.2's core schema does not. The parser that reads the file decides,
so YAML destined for a Python tool should be quoted more defensively than YAML for a
1.2 loader.
Why won't my YAML parse after I edited it?
Most often a tab in the indentation. YAML requires spaces for indentation and rejects
tabs outright, so a block that looks correctly aligned still fails if an editor inserted
tab characters.
What happens to a JSON null?
It becomes YAML null, usually written as an empty value or a tilde ~.
Reading it back yields null again — but note that the unquoted words
null, Null, and ~ all mean the same thing, while
the quoted "null" is the string.
Does conversion preserve key order?
The output keeps the order of keys as written, which helps readability in a config
file. Semantically, though, both JSON objects and YAML mappings are unordered, so no
consumer should depend on that order for correctness.