YAML to JSON Converter

Convert YAML to JSON, JSON to YAML, or YAML to XML and CSV. Paste either format and the converter detects it, parses it with a full YAML parser and shows any error with its line number. Nothing is uploaded.

Free online YAML to JSON converter

Convert YAML to JSON — or JSON to YAML — instantly in your browser. Paste either format and get the other with proper formatting. The converter uses a full YAML 1.2 parser (js-yaml), so anchors and aliases, merge keys, multi-line block scalars and multi-document files all convert correctly, and syntax errors are shown with the line and column.

One YAML document, four output formats

ConversionWhat you get
YAML → JSONPretty JSON with 2 or 4 spaces or tabs, or minified. A multi-document file becomes a JSON array, one element per document. Dates become ISO 8601 strings.
JSON → YAMLBlock-style YAML with your chosen indent. Strings that would change type ("yes", "1.0") are quoted automatically.
YAML → XMLAn XML document under the root element you name, one child element per key and an <item> element per list entry. Keys that are not valid XML names are sanitised.
YAML → CSVA list of records becomes one row per record with a header row; nested keys are flattened to dot paths (address.city) and simple lists are joined with ; . A single mapping becomes key,value rows. Choose comma, tab (paste into Excel) or semicolon.

Example: a two-item list of name/age mappings converts to the CSV name,age, Ada,36, Alan,41.

What is YAML?

YAML (YAML Ain’t Markup Language) is a human-readable data serialization format that uses indentation instead of brackets. It is a superset of JSON — any valid JSON is also valid YAML 1.2 — but adds features that make it better for configuration files: comments, multi-line strings, anchors and aliases, and optional string quotes.

Key differences between YAML and JSON

When to use each format

YAML: config files maintained by humans — Kubernetes manifests, Docker Compose, GitHub Actions, Helm charts, Ansible playbooks. Comments and readability matter more than parse speed.

JSON: API payloads, machine-to-machine exchange, JavaScript tooling configs (package.json, tsconfig.json), NoSQL database documents. Strict syntax prevents type coercion surprises.

Common questions

How do I convert YAML to JSON?

Paste the YAML (or open a .yaml file) and choose YAML → JSON, or leave Auto-detect on. The YAML is parsed with a full YAML parser and written out as indented or minified JSON. Copy it or download it as a .json file.

Can I convert YAML to XML or CSV?

Yes. Choose YAML → XML to get an XML document with a root element and an item element for each list entry, or YAML → CSV to get one row per record in a list of mappings, with nested keys flattened to dot paths such as address.city. A single mapping becomes key,value rows.

Is YAML a superset of JSON?

Yes. In YAML 1.2, any valid JSON document is also valid YAML, so you can parse a JSON file with a YAML parser. The reverse is not true: YAML comments, anchors and block scalars have no JSON equivalent.

What is the YAML boolean gotcha?

In YAML 1.1, used by many tools, values like yes, no, on and off are parsed as booleans, so the country code NO becomes false, and version 1.10 becomes the number 1.1. Quote strings that look like booleans or numbers: country: "NO", version: "1.10".

Are YAML comments kept when converting?

No. JSON has no comment syntax, and a YAML parser discards comments while reading, so converting YAML to JSON and back produces the same data without the comments.

Why does Kubernetes use YAML instead of JSON?

Kubernetes supports both, but YAML is the default because it is more readable for complex nested configs, supports comments for explaining choices, and is less verbose for humans to write. Most kubectl commands accept JSON too.