YAML to JSON Converter
Convert YAML to JSON, with anchors and aliases resolved.
YAML input
Tab inserts indentation. Press Escape, then Tab, to move focus out of the editor.
JSON output
How to convert YAML to JSON
- Paste YAML on the left, or open or drop a .yaml or .yml file.
- The JSON appears on the right as you type.
- If the YAML has an error, it's shown with its line and highlighted.
- Copy the JSON or download it as a .json file.
Full YAML support, not just the basics
Real-world YAML uses more than keys and lists. The converter uses a complete YAML 1.2 parser, so anchors (&defaults), aliases (*defaults), merge keys (<<), block strings and multiple documents are all resolved into plain JSON.
defaults: &defaults
retries: 3
prod:
<<: *defaults
url: https://api.example.com{
"defaults": { "retries": 3 },
"prod": { "retries": 3, "url": "https://api.example.com" }
}Use cases
- Read Kubernetes, Docker Compose or CI config in code that expects JSON.
- Convert an OpenAPI spec from YAML to JSON for tools that need JSON.
- Debug what a YAML file actually contains after anchors are resolved.
What changes when YAML becomes JSON
base: &b
a: 1
prod:
<<: *b
b: 2
flag: no
ver: 1.10
when: 2026-10-14{
"base": { "a": 1 },
"prod": { "a": 1, "b": 2 },
"flag": "no",
"ver": 1.1,
"when": "2026-10-14"
}- Anchors and merge keys (
<<) are expanded, because JSON has no references. nostays the string"no"under YAML 1.2 rules — older YAML 1.1 tools would read it asfalse.- Unquoted
1.10is a number, so it becomes1.1. Quote version numbers in YAML to keep them as written. - Comments are dropped: JSON has no comment syntax.
Related YAML and JSON tools
Convert back with JSON to YAML. If the YAML won't parse, the YAML validator explains why. Afterwards, sort or tidy the JSON with the JSON formatter, or convert spreadsheet data with CSV to JSON.
Frequently asked questions
- Are YAML anchors and aliases supported?
- Yes. Anchors (&name), aliases (*name) and merge keys (<<) are resolved, so the JSON contains the full data.
- What happens to YAML comments?
- JSON has no comments, so they are dropped. The data itself is converted completely.
- What if the YAML file has several documents?
- Documents separated by --- become a JSON array with one entry per document.
- Which YAML version is used?
- YAML 1.2, the current version. In YAML 1.2, yes and no are strings, not booleans; use true and false for booleans.
- How do I keep a value like 1.10 or 007 as text?
- Quote it in the YAML: version: "1.10" or zip: "007". Unquoted, YAML reads them as the numbers 1.1 and 7, and the JSON output follows that interpretation.