YAML ↔ JSON Converter
Paste YAML on the left, get JSON on the right (or paste JSON on the right, get YAML on the left). Errors highlighted with line numbers. Everything stays in your browser.
What's the difference between YAML and JSON?
JSON is a strict subset of JavaScript object literal syntax — terse, machine-friendly, finicky about quotes and commas. YAML (YAML Ain't Markup Language) is a superset of JSON with much friendlier human syntax: indentation instead of braces, optional quoting, comments, anchors and aliases for repetition.
Every valid JSON document is also valid YAML. The reverse is not true — YAML has features (tags, anchors, multi-document streams) that don't exist in JSON.
Common gotchas
- Tabs vs spaces. YAML disallows tabs for indentation in most parsers. Use spaces. Mixed indentation is the #1 source of YAML errors.
- The Norway problem. YAML 1.1 (still common in tools like Ansible) treats
NO,no,OFF,YES,ONas booleans. So a country list with "Norway" can become[false, ...]. Quote the strings explicitly:- "NO". - Numbers with leading zeros. In YAML 1.1,
012is octal 10, not decimal 12. Use quotes for any string-shaped number. - Empty values. A bare
key:with nothing after parses as null in YAML. JSON has no implicit null shortcut. - Multi-line strings. YAML supports
|(literal, preserve newlines) and>(folded, joined with spaces). Choose carefully — converting back to JSON will turn both into ordinary strings with embedded newlines.
YAML 1.1 vs 1.2
Most software uses YAML 1.1 (older). The 1.2 spec (2009) tightened rules — booleans are only true/false, no more YES/NO; numbers must be standard decimal. JSON is fully compatible with YAML 1.2. js-yaml (this tool's parser) defaults to 1.2 in load mode.
Privacy
The conversion runs entirely in your browser via the open-source js-yaml library (MIT-licensed) embedded into this page. Your input is not sent anywhere.