YAML to JSON Converter
This free converter turns YAML into JSON and back, entirely in your browser, and then reports what the conversion changed. It reads your file as YAML 1.2 or YAML 1.1 and shows every value the two versions disagree about, including the Norway problem, merge keys and comments that cannot survive.
What does this converter do?
It converts YAML to JSON and back, and then does the part every other converter skips: it tells you what the conversion changed and what it threw away.
- Both YAML versions, side by side. Read your file as 1.2 or 1.1 and see every value the two disagree about, with the path to each one.
- The Norway problem, named and located. Not a warning in general: the actual lines in your file.
- Merge keys. It tells you whether your
<<actually merged, which depends entirely on the version. - What JSON cannot hold: comments, anchors, multiple documents, NaN and Infinity. Counted before you convert.
- Duplicate keys refused, with the line, instead of silently keeping the last one.
- Both directions on one page, because two pages for one job is duplicate content.
- Copy or download, keeping your filename:
deploy.yamlbecomesdeploy.json. - Nothing leaves your browser. Infrastructure YAML carries host names, bucket names and sometimes credentials.
The trap that has no good answer
Take an ordinary docker-compose file with a merge key, a timezone and a retry count. Here is the same file read both ways:
| In the file | Read as YAML 1.1 | Read as YAML 1.2 |
|---|---|---|
<<: *common | merges, as intended | does not merge, becomes a literal << key |
TZ: NO | false | "NO" |
RETRIES: 010 | 8 (octal) | 10 |
TIMEOUT: 1:30 | 90 (sexagesimal) | "1:30" |
Read it one way and the merge works but three values are wrong. Read it the other way and the values are right but the merge is gone. Neither version gives you what the file looks like it says. That is not a flaw in this page, it is the actual state of YAML, and it is why the fix is always the same: quote the values you mean as text.
Docker Compose, Ansible and PyYAML are YAML 1.1. Most newer parsers are 1.2.
What else disappears
| YAML has | In JSON it becomes |
|---|---|
| Comments | gone, and nothing can bring them back |
| Anchors and aliases | full copies, so the file grows |
Multiple documents (---) | one array |
.nan, .inf | null, silently |
1.20 | 1.2, because it is a number |
The NaN one is worth singling out. YAML can express it, JSON cannot, and JSON.stringify writes null without complaining. No parser reports an error, no linter flags it, and the value is simply gone.
What this tool does not do
- It does not preserve comments in a round trip. JSON has no comments, so once converted they are gone. No converter can do this, and any that claims to is keeping them somewhere outside the JSON.
- It does not validate against a schema. It will not tell you whether Kubernetes or your CI will accept the file, only what it means.
- It is not a YAML linter or formatter. It converts and diagnoses types.
- The comment and anchor counts are a text scan, not a full parse. They are there to warn you, not to be exhaustive.
- One parser, two schemas. Your own parser may differ again, which is exactly why both readings are shown rather than one answer.
Is my file private?
Yes. The parser is a JavaScript library that loads into your browser, and every conversion and check runs there. No network request carries your file, nothing is logged or stored, and closing the tab clears it. This is not a small detail for this particular format: a docker-compose or Kubernetes manifest usually names your hosts, your buckets and your internal services, and sometimes carries a secret that should not have been in the file at all.
Frequently asked questions
Why does YAML turn NO into false?
Because YAML 1.1 treats yes, no, on, off, y and n as booleans, so the country code NO becomes false. YAML 1.2 removed that and keeps them as strings, but plenty of tools still use 1.1. Quoting the value keeps it a string everywhere.
What is the YAML Norway problem?
It is the nickname for that boolean conversion, because Norway has the country code NO. Nothing errors: the config loads, the value is false, and the application quietly does the wrong thing. This page shows every value in your file that the two YAML versions read differently.
Does the merge key work in YAML 1.2?
No, and this surprises people. The merge key is a YAML 1.1 feature. Read as 1.2, the double angle bracket stays a literal key holding a copy of the anchored map, and nothing is merged. Docker Compose and GitLab CI rely on it, so read those as 1.1.
What happens to comments when converting YAML to JSON?
They are lost, and there is no way around it. JSON has no comment syntax, so there is nowhere to put them. This page counts them before you convert, because replacing a documented config with an undocumented one is easy to do by accident.
What happens to YAML anchors and aliases in JSON?
Each reference becomes a full copy of the value, since JSON has no anchors. The output can be much larger than the input, and converting back will not recreate them. This page counts the anchors it found so the size change is not a surprise.
Can JSON store NaN and Infinity from YAML?
No. YAML can write .nan, .inf and -.inf, and JSON has no way to hold them, so they come out as null. Nothing reports an error, which makes this one of the quietest ways to lose a value in a conversion.
Why did my version number change from 1.20 to 1.2?
Because unquoted 1.20 is a number, and that number is 1.2. The trailing zero has no meaning in arithmetic, so it disappears. If it was meant as a version string, quote it. This happens in YAML 1.1 and 1.2 alike, so it is a loss rather than a disagreement.
What happens with duplicate keys in YAML?
This page refuses the file and points at the line, which is the safer behaviour. Many parsers accept duplicates and silently keep only the last value, so a setting can appear in the file, look correct on review, and have no effect at all.
Can it convert JSON back to YAML?
Yes, both directions are on this page rather than split across two. Bear in mind a round trip does not restore anything: comments, anchors and document separators were already gone, so what comes back is the data, not the original file.
Is my YAML sent to a server?
No. The parser loads into your browser and every conversion and check runs there, so nothing is uploaded, logged or stored. This matters more than usual here, because infrastructure YAML tends to carry host names, bucket names and sometimes credentials.
Related tools
DeveloperJSON FormatterFormat, beautify, and validate JSON right in your browser.- DeveloperCSV to JSON ConverterTypes decided per column, so ZIP codes keep their zeros.
- DeveloperCron Expression GeneratorReads your cron line and warns about the traps it hides.
- DeveloperSchema Markup GeneratorJSON-LD that says whether Google still shows that rich result.
DeveloperToken CounterCount tokens exactly, check the context window, estimate the cost.
Rate YAML to JSON Converter & help shape it
This tool is free and still growing. Tell us what works, what you would change, and what is missing. Your feedback is what decides what we build next.
Last updated: September 20, 2026