YAML to JSON Converter

Bidirectional YAML ⇄ JSON converter — convert YAML to JSON or JSON to YAML, live, in your browser.

Free online YAML to JSON converter and JSON to YAML converter in one tool — paste either format, pick a direction, and get clean, correctly-typed output instantly. Adjustable JSON indent width and YAML block/flow style. No data ever leaves your browser.

Examples:

Direction

JSON indent

YAML style

Quick reference

key: value
{"key":"value"}
- a
- b
["a","b"]
~ / null
null
All JSON
is valid YAML

Loading converter…

Frequently asked questions

Switch this tool to "YAML → JSON" mode and paste your YAML into the input — valid JSON appears automatically on the right. Pick an indent width of 2 or 4 spaces from the options panel. The conversion runs entirely in your browser, so nothing you paste is uploaded anywhere.
Switch this tool to "JSON → YAML" mode and paste your JSON into the input — YAML appears automatically on the right. Choose block style (one key per line, the common convention) or flow style (compact, JSON-like brackets) from the options panel.
JSON uses braces, brackets, and quotes and is easy for machines to parse. YAML uses indentation instead of braces, supports comments, and is easier for humans to read and hand-edit. Every JSON document is valid YAML — YAML is a superset of JSON syntax — but not every YAML document is valid JSON, since YAML supports features like comments, anchors, and multi-line strings that JSON lacks.
YAML is the default configuration format for tools like Docker Compose, Kubernetes, GitHub Actions, Ansible, and CircleCI because it supports inline comments (which JSON does not), reads cleanly without brackets or trailing-comma errors, and handles multi-line strings naturally. JSON remains the standard for APIs and data interchange because its stricter grammar is faster and less ambiguous to parse programmatically.
Yes. If your YAML or JSON is malformed, the tool shows a specific, friendly error message describing what's wrong (for example, bad indentation, an unclosed bracket, or a stray comma) instead of a blank output or a crash.
Comments are supported on the YAML input side — they are simply dropped when converting YAML to JSON, since JSON has no comment syntax. YAML anchors and aliases (&anchor / *alias) are resolved and expanded to their full values on input; JSON to YAML output does not re-introduce anchors, so the result is always plain, unambiguous YAML.
No. The conversion runs locally in your browser using the js-yaml library — nothing you paste is ever sent anywhere.