1. Home
  2. Guides
  3. Developer

How to Convert YAML to JSON (and Back) Without Surprises

4 min readUpdated October 7, 2026

YAML ⇄ JSONConvert YAML and JSON both ways. Free, no sign-up.

YAML and JSON describe the same kinds of data (objects, lists, strings, numbers, true/false, null). YAML is easier to write by hand, which is why Docker Compose, Kubernetes, GitHub Actions and many apps use it. JSON is what most APIs and programs expect. Converting between them is common, and mostly painless.

Convert

  1. Open YAML to JSON.
  2. Paste your YAML. The JSON appears next to it as you type.
  3. Choose the indentation, then copy or download the result.
  4. Use the swap button to go the other way, from JSON to YAML.

Files are converted in your browser, so configuration with hostnames or secrets is not uploaded. Still, avoid pasting real passwords into any tool you don’t need to.

Example

service: invoices
port: 8080
debug: false
owners:
  - ada
  - grace

becomes

{
  "service": "invoices",
  "port": 8080,
  "debug": false,
  "owners": ["ada", "grace"]
}

(The converter puts each list item on its own line; it is shortened here.)

YAML traps to know

YAML guesses types from how values look. That is convenient until it guesses wrong. This converter follows YAML 1.2, the current version; some tools (PyYAML, older Ruby and Go libraries) still follow YAML 1.1 and guess even more:

You write You might expect This converter gives Older YAML 1.1 tools Fix
version: 1.10 “1.10” the number 1.1 the number 1.1 version: "1.10"
zip: 01234 “01234” the number 1234 a number, possibly octal (668) zip: "01234"
country: NO (Norway) “NO” “NO” false country: "NO"
time: 12:30 “12:30” “12:30” the number 750 (12 × 60 + 30) time: "12:30"

Converting to JSON is a quick way to see what a YAML file really means. If a value in the JSON is not what you meant, put quotes around it in the YAML. Quoting is also the safest choice when the same file is read by several tools.

Other differences

Next steps

Check or tidy the JSON with the JSON Formatter, which also finds syntax errors with line and column. If your data is a table rather than a config file, CSV to JSON is the better fit.