JSON โ YAML Converter
Convert between JSON and YAML instantly โ paste either format
About this tool
The JSON <-> YAML Converter transforms data between JSON (JavaScript Object Notation) and YAML (YAML Ain't Markup Language) formats instantly. YAML uses indentation for structure and is favored for config files due to readability. JSON uses braces and brackets and is the standard for APIs and data interchange.
When to use it
- โConverting Docker Compose or Kubernetes manifests between YAML and JSON
- โTransforming GitHub Actions or CI/CD pipeline configs
- โReading YAML config files in tools and runtimes that only accept JSON
- โMigrating application config from one format to the other
Tips
- โYAML is a superset of JSON โ valid JSON is also valid YAML, but YAML supports additional features like anchors (&) and aliases (*) that JSON does not.
- โYAML indentation must be consistent โ mixing tabs and spaces causes parse errors.
Frequently asked questions
When should I use YAML vs JSON for config files?
YAML is preferred for human-edited config files: it supports comments, is less noisy (no quotes around simple strings, no braces), and is easier to read at a glance. JSON is preferred for machine-generated or API-transmitted data: it is stricter, has no ambiguity, and is natively supported in every language without a library. Use YAML where humans write it, JSON where machines do.
Does YAML support all JSON features?
YAML is a superset of JSON โ every valid JSON document is also valid YAML. YAML adds features JSON lacks: comments (#), multi-line strings (| and >), anchors and aliases (&name and *name for reuse), and more flexible quoting rules. The reverse is not true: YAML anchors and unquoted strings don't translate to JSON.
Why does my YAML parse to unexpected types?
YAML auto-detects types from context. Bare values like true, false, null, yes, no, on, off are parsed as booleans or null. Numbers without quotes become integers or floats. Strings that look like those values must be quoted: 'true', 'no', '1.0'. This is a common YAML gotcha โ always quote values that should stay as strings.
What are YAML anchors and aliases?
Anchors (&name) mark a value for reuse, and aliases (*name) reference it later in the same file. For example, defaults: &defaults env: production followed by staging: <<: *defaults env: staging merges the defaults and overrides env. This DRY pattern is common in complex CI/CD and Kubernetes configs, but is not supported in JSON.