📐
YAML Formatter
Format · Validate · YAML↔JSON conversion
Ctrl+Enter = run
📐Output appears herePaste YAML then click Format
chars: 0 lines: 0

YAML to JSON

Free online YAML formatter and validator. Beautify YAML, check for syntax errors, and convert YAML to JSON or JSON to YAML. Fully client-side using js-yaml — nothing is sent to any server.

Free No login 100% browser-based No data sent to servers

Try these next

What is a YAML to JSON?

YAML (YAML Ain't Markup Language) is a human-readable data serialisation format used heavily in configuration files — Kubernetes manifests, Docker Compose files, GitHub Actions workflows, and Ansible playbooks are all YAML. Its indentation-based structure is readable but unforgiving: a single wrong indent causes a parse error that can be hard to locate.

This tool parses, validates, and reformats YAML using the js-yaml library in your browser. Paste any YAML to check for syntax errors, normalise indentation (2 spaces), and produce clean, canonical output. Also converts YAML to JSON for quick inspection.

What is YAML?
YAML (YAML Ain't Markup Language) is a human-readable data serialization format commonly used for configuration files. It uses indentation to represent structure, making it more readable than JSON or XML. Popular in Kubernetes, Docker Compose, GitHub Actions, and Ansible.
What's the difference between YAML and JSON?
YAML is a superset of JSON — any valid JSON is also valid YAML. YAML supports comments (JSON doesn't), uses indentation instead of braces, and is more readable for complex config files. JSON is better for APIs and data exchange due to its simplicity and broad language support.
Why does my YAML fail to parse?
Common YAML errors: incorrect indentation (must be consistent spaces, not tabs), missing quotes around strings with special characters (: { } [ ] , & * # ? | - < > = ! % @ \), and duplicate keys. YAML is whitespace-sensitive — even a single extra space can break parsing.
What is YAML and when should I use it instead of JSON?
YAML (YAML Ain't Markup Language) is a human-readable data serialisation format. Use YAML over JSON when the file will be edited by humans (config files, CI/CD pipelines, Kubernetes manifests, Docker Compose) because YAML supports comments and is less cluttered with brackets and quotes. Use JSON for API responses and machine-to-machine communication where parsing speed and strict syntax matter.
What are the most common YAML syntax mistakes?
Indentation with tabs (YAML requires spaces only). Inconsistent indentation depth within the same block. Missing space after colon in key: value pairs. Special characters in unquoted strings (: # { } [ ] , & * ? | - < > = ! % @ ` must be quoted). Duplicate keys (silently overwritten). Multiline strings not using the correct | or > block scalar style.
What is the difference between YAML block style and flow style?
Block style uses newlines and indentation (human-readable, multi-line). Flow style uses inline JSON-like syntax with brackets and braces. Example — Block: "name: John\nage: 30". Flow: "{name: John, age: 30}". Both are valid YAML. Block style is preferred in config files; flow style appears in autogenerated YAML.
Is YAML a superset of JSON?
Yes — valid JSON is valid YAML 1.2 (with minor exceptions). YAML 1.2 was specifically designed to make all valid JSON documents also valid YAML documents. This means you can use a YAML parser to read JSON files. The reverse is not true — YAML documents with comments, anchors, or tags are not valid JSON.

Also available as

✓ Copied!