Skip to the tool
Tools

JSON ⇄ YAML Converter

Convert JSON to YAML and YAML to JSON. Direction is detected automatically, merge keys are expanded, and tabs are fixed in one click.

Direction
Indent
Result Waiting for input
Paste JSON or YAML — the direction is worked out for you. Try

Both directions, one page

Paste either format and the direction is worked out from what you gave it. JSON is also valid YAML, so if you need a specific direction for something ambiguous, set it explicitly.

Tabs are the usual reason YAML will not parse

YAML allows only spaces for indentation, never tabs — and most editors insert tabs unless told otherwise. Paste a file with tab indentation and you will be offered a one-click fix rather than a parser message about deficient indentation.

What << does

A merge key copies another mapping's keys into this one, so shared configuration is written once. It is everywhere in docker-compose and GitLab CI files.

JSON has nothing equivalent, so the merge is expanded during conversion. A key you wrote explicitly always beats the merged value, which is what the merge means.

Several documents in one file

A line containing only --- starts a new YAML document, and a Kubernetes manifest often holds a dozen. JSON holds exactly one value, so you will be offered them as an array.

Large numbers lose digits in one direction only

Going from JSON to YAML, numbers are copied exactly as written. Coming back the other way they pass through JavaScript, where integers above 9,007,199,254,740,991 lose their last digits. When that happens you get told rather than left to discover it.

What YAML has that JSON does not

Comments, anchors and aliases, multiple documents, and unquoted strings. Comments are dropped because JSON cannot hold them. Anchors are expanded to the values they point at, unless one refers to itself, which would never terminate.