JSON to YAML Converter

Turn JSON into readable YAML — and convert straight back.

JSON
YAML
Send output to

Two formats for the same tree

JSON and YAML describe identical data structures — maps, lists and scalars. The difference is entirely in presentation, and each is better at a different job. JSON is unambiguous and machine-friendly, which is why APIs speak it. YAML is readable and diffable, which is why Kubernetes, Helm, GitHub Actions, Compose and Ansible all chose it for files that humans edit and review.

Converting between them is a routine step: an API hands you JSON, and the manifest you are writing wants YAML. Doing it by hand means re-indenting every nesting level and remembering which strings need quoting.

What this converter is careful about

  • Key order is preserved. Alphabetising by default would scramble the reviewable structure of a manifest. Sorting is available as an explicit toggle when you want stable diffs.
  • Ambiguous scalars get quoted. This is the notorious YAML footgun: no becomes boolean false, 1.10 becomes the number 1.1, and a Norway country code of NO turns into false. Anything that would be re-read as the wrong type is quoted on the way out.
  • Multi-line strings become block scalars. A certificate or a script embedded in a value stays readable as a | block rather than collapsing into one line of escape sequences.

Converting back

The swap control runs the conversion in reverse. The YAML reader covers the subset configuration files actually use — block mappings and sequences, quoted and plain scalars, flow collections, block scalars and comments. It is not a conforming YAML 1.2 processor: exotic features such as anchors with merge keys, custom tags and multi-document streams are outside its scope, and it will tell you rather than guess. Comments are dropped in the YAML-to-JSON direction because JSON has nowhere to keep them.

Everything happens in this tab

Configuration files are exactly the kind of thing you should not paste into a remote service. They carry registry hostnames, environment values, internal service names and occasionally a secret that should have been a reference. Nothing typed here is transmitted — the parser and the emitter both ship as part of this page.

Questions people actually ask

Does the converter preserve key order?
Yes. Keys are emitted in the order they appear in the source document, which matters when the YAML is reviewed in a pull request.
How are multi-line strings handled?
Strings containing newlines are emitted as YAML block scalars using the pipe form, so the line breaks survive a round trip instead of becoming escape sequences.
Can I convert YAML back to JSON?
Yes — use the swap control. The reverse direction covers the common YAML subset: mappings, sequences, scalars, anchors and comments (comments are dropped, since JSON has nowhere to put them).
navigate open esc close