All tools
Development tools

YAML ↔ JSON Converter

Convert YAML to JSON or JSON to YAML — bidirectional, validates syntax, handles multi-document YAML and anchors/aliases.

Bidirectional Multi-doc YAML Anchors & aliases Inline validate Pretty-print Copy output
Get started free Sign in

Free · No credit card · 50 credits/day

YAML gotchas — values that surprise developers

YAML value Parsed as Fix (force string)
yes / no Boolean true / false (YAML 1.1) "yes" / "no"
on / off Boolean true / false (YAML 1.1) "on" / "off"
null / ~ null "null" / "~"
1.0 Float "1.0"
0x1F Integer (hex) "0x1F"
2024-01-01 Date object (some parsers) "2024-01-01"
Tabs (indentation) Parse error — tabs not allowed Use spaces only

YAML 1.2 removed the yes/no/on/off booleans — but many parsers still use YAML 1.1 rules. Quote these values to be safe.

Frequently asked questions

When should I use YAML instead of JSON?

YAML is better for human-edited config files: it supports comments (JSON doesn't), multi-line strings are natural, and there are no trailing-comma issues. It is the standard for Kubernetes, Docker Compose, and GitHub Actions. JSON is better for machine-generated data and API payloads: strict spec, universal library support.

What are YAML anchors and aliases?

Anchors (&name) mark a node and aliases (*name) reference it, avoiding repetition. The << merge key absorbs all key-value pairs from the anchored mapping. When converting YAML with anchors to JSON, the converter expands them so JSON gets fully resolved values.

Why does YAML treat "yes", "no", "on", "off" as booleans?

In YAML 1.1, these values (and their capitalised variants) are all parsed as boolean true or false. This is a common gotcha — "no" means false, not the string "no". YAML 1.2 restricted booleans to only true/false. Quote these values ("yes", "no") to force string interpretation.

Can YAML files contain multiple documents?

Yes. YAML uses --- as a document separator. A single .yaml file can contain multiple documents. When converting multi-document YAML to JSON, each document becomes a separate JSON object. Kubernetes kubectl apply -f accepts multi-document YAML and processes each document independently.

Related dev tools

More format converters and parsers.

JSON Formatter

Format and validate JSON — useful for inspecting the JSON output after converting from YAML.

CSV → JSON Converter

Convert tabular CSV data to JSON, then convert to YAML for config use.

Cron Parser

Parse cron expressions from GitHub Actions or Kubernetes CronJob YAML.

Convert YAML and JSON instantly

Free account. 50 credits per day. Access to 75+ tools instantly.

Create free account →