JSON ↔ YAML Converter

Used 6,800 times

Convert JSON to YAML or YAML to JSON instantly — in your browser. No data leaves your machine.

0 chars
0 chars

JSON vs YAML

JSON (JavaScript Object Notation) and YAML (YAML Ain't Markup Language) both represent structured data but serve different contexts. JSON is verbose but unambiguous — ideal for APIs and data interchange. YAML uses indentation and minimal punctuation — preferred for config files (Kubernetes, GitHub Actions, Docker Compose, Helm). They are semantically equivalent for most data types and fully interconvertible.

How to Use

  1. Paste JSON or YAML into the input box.
  2. Click JSON → YAML or YAML → JSON depending on the direction.
  3. The converted output appears immediately. Click Copy Output to copy it.
  4. Syntax errors in the input are shown inline so you can fix them before converting.

Common Conversion Issues

  • Tabs in YAML — YAML requires spaces for indentation. Tabs will cause a parse error before conversion can begin.
  • YAML special values — Bare yes, no, null, and ~ are parsed as booleans or null — quote them if you intend string values.
  • Integer-like keys — JSON object keys are always strings; YAML may parse numeric-looking keys differently depending on the parser.
  • Multiline strings — YAML block scalars (|, >) convert to escaped \n strings in JSON.

FAQs

Is YAML a superset of JSON?

Yes, per the YAML 1.2 spec. Valid JSON is also valid YAML, which is why JSON can be embedded directly inside YAML files.

Does conversion preserve comments?

No. YAML supports comments (# ...) but JSON does not. Comments are stripped during YAML-to-JSON conversion and cannot be round-tripped.

Are all JSON types representable in YAML?

Yes — objects, arrays, strings, numbers, booleans, and null all have direct YAML equivalents. There is no data loss when converting from JSON to YAML.