YAML to JSON Converter
Convert YAML to JSON and JSON back to YAML as you type, with anchors resolved and parser errors reported inline.
YAML
paste or load a sampleJSON
The converted document appears here as you type.
About YAML and JSON conversion
Every valid JSON document is also a valid YAML 1.2 document, so JSON → YAML is always lossless. The other direction is not: YAML carries features JSON has no way to express, and the conversion has to resolve them. This tool parses with the yaml library’s YAML 1.2 core schema, entirely in your browser — nothing is uploaded.
What changes on the way to JSON
- Comments disappear. JSON has no comment syntax, so every
#line is dropped. Converting back will not restore them. - Anchors and aliases are expanded. An
&defaultsanchor referenced by*defaultsor merged with<<becomes a full copy at every use site, so the output is larger and the shared identity is gone. - Multi-document streams collapse. A file split by
---— a Kubernetes manifest bundle, typically — has no single-value JSON equivalent, so multiple documents come out as a JSON array. - Non-string keys are stringified. YAML allows
true, numbers, or whole maps as mapping keys; JSON object keys are always strings.
Type coercion gotchas
- YAML 1.1 booleans. The older spec — still what Python’s PyYAML, Ruby’s Psych, and many CI runners implement by default — reads
yes,no,on, andoffas booleans. YAML 1.2 recognises onlytrueandfalse, so the same file can mean different things to two parsers. - The Norway problem. Under YAML 1.1 the country code
NOparses as the boolean false. So doN,Y, andON. Quote them. - Version strings become floats. An unquoted
version: 1.10is the number 1.1, and the trailing zero is lost forever. Leading-zero values like08are read as octal by YAML 1.1 and reject 8 and 9 as digits. - Sexagesimal numbers. YAML 1.1 treats colon-separated digits as base 60, so a build time of
12:30arrives as 750. Ports written as80:80in a Compose file are the classic casualty. - Dates and timestamps. YAML 1.1 auto-resolves
2026-01-31to a date object. JSON has no date type, so it serialises back as an ISO string — usually with a time component you did not write.
Tip: when a YAML value is meant to stay text — version numbers, country codes, ports, phone numbers, git SHAs, anything with a leading zero — wrap it in quotes. Round-tripping through this converter is a quick way to see which of your values a parser is quietly retyping.