Developer · Converter
JSON to YAML converter.
Paste JSON to get clean block-style YAML, or switch direction to turn YAML into JSON. Values that YAML would read as another type, such as "yes", "null" or "007", are quoted so they stay strings. Runs in your browser; nothing is sent anywhere.
Input
Result
Paste JSON and press Convert.
Worked example with edge cases
This JSON:
{"name":"api","version":"1.10","enabled":"yes","nothing":null,"id":"007","port":8080,"note":"line1\nline2","tags":["a","true"],"empty":[]}
becomes:
name: api version: '1.10' enabled: 'yes' nothing: null id: '007' port: 8080 note: |- line1 line2 tags: - a - 'true' empty: []
Look at what changed. "1.10", "yes", "007" and "true" keep their quotes because unquoted they would resolve to the number 1.1, a boolean or a number under YAML parsers, silently changing your data. null without quotes is the real null, while the string "null" would be quoted. The two-line string becomes a literal block (|-, no trailing newline) instead of a \n escape.
How the conversion works
YAML 1.2 is a superset of JSON (YAML 1.2.2, section 1.3), so every JSON document is already valid YAML. This tool goes one step further and writes the readable block style instead of {...} flow style. The JSON is parsed with the browser's JSON.parse (the grammar of RFC 8259) and written out by js-yaml 4.1.1, which single-quotes any string whose plain form would resolve to a non-string under the YAML core schema (section 10.3.2), or that starts with an indicator such as @, - or contains : or #.
YAML to JSON: every document in the stream is parsed; one document becomes its JSON value, several become an array. YAML features JSON lacks are resolved or lost: comments are dropped, anchors and aliases are expanded, and merge keys (<<) are merged.
Limits to know: numbers are read as IEEE 754 doubles, so an integer beyond 9007199254740991 loses digits (RFC 8259 section 6); the tool warns when it sees one. Object keys follow JavaScript ordering, so keys that look like integers ("2", "10") are listed first. Duplicate keys in JSON collapse to the last one.
Sources (as of 2026-10-01): YAML Ain't Markup Language version 1.2.2; RFC 8259, The JSON Data Interchange Format; js-yaml (MIT), vendored at 4.1.1.
Frequently asked questions
Is JSON already valid YAML?
Yes. YAML 1.2 was designed as a superset of JSON, so a JSON file loads in a YAML 1.2 parser. Some older YAML 1.1 parsers have small differences, for example with tabs or escapes, which is another reason to convert to plain block YAML.
Why are some strings quoted in the output?
Because unquoted they would be read as something else. yes, null, 1.10, 007 and 2026-01-01 can all be turned into booleans, nulls, numbers or dates by a parser. Quotes keep the value a string.
Can I convert a Kubernetes or OpenAPI file?
Yes, both accept JSON and YAML. Convert here, then check the result with the OpenAPI Validator or the Kubernetes Name Validator. This tool does not know either schema.
Do comments survive YAML to JSON?
No. JSON has no comments, so they are dropped. Keep your original YAML.
Format conversion only
This tool changes the notation, not the meaning. It cannot tell you whether the content is right for the program that reads it, and other parsers may differ on edge cases. Nothing you type is stored or sent anywhere.