JSON to YAML

Convert JSON to readable YAML for config files. Values that some YAML readers would misread, like "no" or "1.10", are quoted so they stay strings.

Runs in your browser

JSON

YAML

Converted in this browser tab. Nothing is uploaded.

How to use the JSON to YAML

  1. Paste JSON or open a .json file.
  2. The YAML appears as you type.
  3. Choose 2 or 4 space indentation and how strings are quoted.
  4. Copy or download data.yaml. Press the swap button to convert the other way.

Example

Config with a tricky value
Input
{"name":"api","replicas":3,"country":"no","ports":[80,443]}
Result
name: api
replicas: 3
country: "no"
ports:
  - 80
  - 443

Older YAML readers such as PyYAML would read an unquoted no as false. The quotes keep it a string.

What it does

Safe for every YAML reader
Strings such as yes, no, on, off, 010 and 1.10 are quoted, because YAML 1.1 readers would turn them into booleans or numbers.
Exact numbers
Large integers such as 64-bit IDs are copied digit for digit, not rounded.
Clear JSON errors
Invalid JSON is reported with its line and column before any conversion happens.

Frequently asked questions

Is all JSON valid YAML?

Yes. YAML 1.2 is a superset of JSON, so you could paste JSON into a YAML file. Converting it gives the cleaner block style people expect in config files.

Why are some of my strings in quotes?

Only strings that would change meaning without them are quoted, for example "no", "on", "true" or "0755". Choose "Always double" if you want every string quoted.

Are comments kept?

JSON has no comments, so there are none to carry over.

Is anything I paste sent to a server?

No. It runs entirely in your browser. Nothing you paste or upload is sent, logged or stored.