JSON ⇄ YAML converter

Convert JSON to YAML for config files, or YAML back to JSON for APIs. Errors point to the exact line and column, and strings like no or 0123 are quoted so they survive the trip.

Indent
JSON input
YAML output
Waiting for inputPaste JSON on the left to convert it to YAML.

How to convert between JSON and YAML

  1. Pick a direction with the tabs, then paste your document or open a file. The output updates as you type.
  2. Swap moves the output to the input and flips the direction, which is a quick way to check a round trip.
  3. Copy the result or download it as .yaml or .json.

Details that matter

  • Safe strings: values such as yes, no, on, 012 or 2024-01-01 are quoted in the YAML, because some parsers (YAML 1.1, such as PyYAML) would read them as booleans, numbers or dates.
  • YAML features: comments are dropped, anchors and aliases are expanded, << merge keys are applied, and a file with several --- documents becomes a JSON array.
  • Exact numbers: large integers keep every digit in both directions. YAML's .inf and .nan have no JSON equivalent and become null.
  • Clear errors: bad indentation, duplicate keys or a JSON syntax error are reported with line and column and a code frame.

Frequently asked questions

Which YAML version is used?

Parsing follows YAML 1.2, the current version. The YAML output is quoted so it reads back identically in YAML 1.1 parsers too.

Are YAML comments kept?

No. JSON has no comments, so they are dropped when converting YAML to JSON.

Is my configuration uploaded?

No. Both directions run entirely in your browser, which makes the tool safe for files containing internal hostnames or settings.