What is YAML and how does it relate to JSON?
YAML (YAML Ain't Markup Language) is a human-friendly data serialization format that uses indentation rather than braces and brackets. It is a strict superset of JSON — every valid JSON document is valid YAML. YAML is popular for configuration files (Kubernetes, Docker Compose, GitHub Actions, Ansible) because it is easier to write by hand and supports comments. JSON is preferred for APIs and data exchange because every language can parse it without a separate library. Converting between them is a common DevOps and backend task.
How to use this tool
- 1 Paste YAML into the input panel and click YAML → JSON to see the equivalent JSON.
- 2 Switch to JSON → YAML mode to convert in the other direction.
- 3 Use the swap button to move the output back to input for further conversion.
- 4 Hit the sample button to load a representative example.
Frequently asked questions
Does YAML support everything JSON does?
Yes — YAML is a superset of JSON. But YAML also supports comments (#), multi-line strings (| and >), anchors (&) and aliases (*), and multiple documents in one file (---). None of these have JSON equivalents.
What happens to YAML comments when converting to JSON?
Comments are metadata for the YAML parser and are not part of the data model. They are not preserved in JSON output, because JSON has no comment syntax.
Why does my YAML number become a string in JSON?
YAML infers types: unquoted 1.0 becomes a float, true/false/null have meaning. Quote values in YAML ("1.0") to force them to be strings. This tool uses js-yaml strict mode, which follows YAML 1.2 type rules.
Is a library used?
Yes — js-yaml v4 is loaded from jsDelivr CDN on first use. It runs entirely in your browser.
Is my data sent anywhere?
No. Conversion runs locally using js-yaml in your browser.