JSON to YAML Converter - Convert Both Ways Online
Convert JSON to YAML and back
Converting between JSON and YAML
JSON and YAML describe the same data — maps, lists, strings, numbers, booleans and null — in two syntaxes. JSON is what APIs and package files speak; YAML is what configuration files for Docker, Kubernetes, GitHub Actions and CI pipelines are written in. This converter translates one to the other instantly and takes care of the details that trip people up: quoting, indentation and the odd words YAML treats as booleans.
Steps
- 1 Choose the direction and paste your document into the top box. The result appears below as you type.
- 2 Set the indent width — 2 spaces is the convention in YAML and in most JSON style guides.
- 3 Copy the result, download it as a file, or use the output as new input to check that it round-trips.
What changes between the two formats
YAML drops the braces, brackets and most quotes and uses indentation for structure, so a 40-line JSON object becomes a 25-line YAML document. Keys stay in the same order. Lists become dash items; nested objects become indented blocks; an empty object or list stays written as {} or []. Going the other way, YAML comments are lost because JSON has no comments.
Why some strings come out quoted
In YAML an unquoted yes, no, on, off, true or null is read as a boolean or null, and 123 or 1.0 as a number. A string that looks like one of these must be quoted or it changes type on the way back — the classic example is the country code NO becoming false. The converter quotes exactly those strings, plus anything with leading or trailing spaces, a colon followed by a space, or a leading special character, and leaves everything else plain for readability.
Multi-line strings
A string containing line breaks is written as a YAML block scalar: a pipe on the key line and the text indented underneath, with a minus sign when the string has no trailing newline. That is the form you see in Kubernetes manifests and CI files, and it reads back to exactly the same string.
Indentation and compatibility
The converter writes YAML 1.2, which every modern parser reads — PyYAML, js-yaml, Go yaml, Ruby Psych. Nested keys are indented by the width you choose; the keys of an object inside a list sit two spaces after the dash regardless, as the specification requires. Tabs are never used.