YAML to JSON converter
Paste YAML and get JSON back, with anchors and merge keys resolved and the exact line of any syntax error.
Runs entirely in your browser
- Input
- 0
- Output
- 0
- Change
- 0%
Input up to about 10 MB. It reads YAML 1.2 with the standard types only; custom tags such as !!python/object are refused, not executed.
How to convert YAML to JSON
- Paste your YAML into the box, or press Insert a sample.
- Choose 2 spaces, 4 spaces, tabs or Minify for the JSON layout.
- If the YAML has a syntax error you see its line and column. Otherwise copy the JSON or download it as a
.jsonfile.
From YAML to JSON
YAML and JSON describe the same kind of data: mappings, lists and simple values. YAML is written by people, with indentation instead of braces, comments, and shortcuts like anchors; JSON is what most programs and APIs expect. Converting between them is common when a Kubernetes manifest, a Compose file or an OpenAPI description has to be fed to something that only reads JSON.
Some YAML features have no JSON equivalent, so the converter resolves them. An anchor (&base) marks a block that an alias (*base) can reuse, and a merge key (<<) copies a mapping's entries into another; in JSON each of those becomes a full copy. Comments are dropped, because JSON cannot hold them. A file with several documents separated by --- becomes a JSON array.
The type rules follow YAML 1.2: true and false are booleans, null and ~ are null, numbers are numbers, and everything else, including yes and 2024-05-01, is text. Syntax errors carry a line and column, and the most frequent causes are a tab used for indentation, a key repeated in the same mapping, and a value that is not indented under its key.
Tips
- Need to go the other way? JSON to YAML quotes values like "yes" so they survive the trip.
- Check or tidy the result with the JSON formatter.
- Got tabular data instead? CSV to JSON covers spreadsheets.
Questions
Is my YAML uploaded?
No. The YAML parser is loaded from this site the first time you paste something and runs in your browser. Configuration with passwords or keys in it is not sent anywhere.
Why is yes still the text "yes"?
This tool follows YAML 1.2, where only true and false are booleans. The words yes, no, on and off stay strings, which avoids the so-called Norway problem where the country code NO turns into false under YAML 1.1 parsers. If your consumer is a YAML 1.1 parser, it may read those words differently.
What happens to dates and timestamps?
A value such as 2024-05-01 is kept as the string "2024-05-01". JSON has no date type, and converting it to a number or a different format would lose information.
What about very large integers?
Integers beyond 9,007,199,254,740,991 (253 - 1) are written digit for digit rather than rounded, so an ID such as 12345678901234567890 survives. Be aware that a program that later reads the JSON with ordinary JavaScript numbers will round it.
Are anchors, aliases and merge keys supported?
Yes. &name anchors and *name aliases are expanded, and <<: *name merges a mapping into another. Because JSON has no references, each alias is written out in full.
What is the alias limit and the 20 MB cap?
A small YAML file can use aliases that expand into something enormous, known as an alias bomb. Files with more than 10,000 aliases are refused, and conversion stops if the JSON would pass 20 MB, so your tab is not frozen.