JSON to YAML converter: convert JSON to YAML online

Paste JSON or open a file and get clean YAML: 2- or 4-space indent, safe quotes for values like "no" and "on", errors with line and column. Runs in your browser.

Need the other way? YAML → JSON

How to use

Paste JSON into the top box — YAML appears below right away, no button needed. Pick the indent: 2 spaces (the usual choice for Kubernetes, Docker Compose and GitHub Actions) or 4. If the JSON has an error, you’ll see the line and column under the box.

Nothing is sent to a server — the conversion runs in your browser, so it’s fine to paste configs with keys and passwords.

Example

{"name": "web", "replicas": 2, "debug": false, "country": "no", "ports": [80, 443]}

becomes

name: web
replicas: 2
debug: false
country: "no"
ports:
  - 80
  - 443

Why some values are quoted

In the older YAML 1.1 standard, words like no, yes, on and off are read as booleans, 2024-01-15 as a date and 12:30 as a base-60 number. Plenty of tools still read YAML that way — PyYAML in Python, for one. To keep the string "no" from your JSON from turning into false there, the converter quotes such values. Ordinary strings stay unquoted.

FAQ

How is YAML different from JSON? It’s the same data written differently: YAML uses indentation instead of brackets and allows comments. Any JSON is valid YAML 1.2.

Is the key order kept? Yes, except for numeric keys: keys like "10" or "2" move to the start of the object under JavaScript’s rules.

Can I convert an OpenAPI or Swagger spec? Yes, it’s ordinary JSON. Check the result right away with the YAML validator.

What about very large numbers? JavaScript can’t store integers longer than 15–16 digits (above 2⁵³) exactly, so the last digits may change. Keep such IDs as quoted strings in your JSON.

How do I convert back? Use the YAML to JSON converter.