YAML to JSON Converter
Turn a YAML file into JSON so you can inspect it, feed it to a tool that only speaks JSON, or find out why it will not parse.
Your data stays on your device
Input — YAML
- characters
- 0
- lines
- 0
- size
- 0 B
Output — JSON
- characters
- 0
- lines
- 0
- size
- 0 B
Options
About this tool
YAML is comfortable to write and unforgiving to debug. A single misaligned space changes which parent a key belongs to, and tab characters are rejected outright as indentation. Converting to JSON makes the resulting structure explicit, which is often the fastest way to see that a key ended up one level too deep.
The parser follows YAML 1.2, resolving anchors and aliases, expanding block scalars, and reporting syntax problems with a line and column so you can go straight to the offending row.
How to use this tool
- Paste YAML or upload a .yaml or .yml file.
- Choose the JSON indent width for the output.
- Press Convert. Errors are reported with a line, a column and an explanation.
- Copy the JSON or download it.
Key features
- YAML 1.2 parsing with anchors and aliases resolved
- Block scalars and folded scalars expanded correctly
- Multi-document streams reported, with the first document converted
- Indentation and tab errors located by line and column
- Configurable output indentation
- Duplicate key detection surfaced as a warning
Example
Input — YAML
server:
host: localhost
ports:
- 8080
- 8443
debug: falseOutput — JSON
{
"server": {
"host": "localhost",
"ports": [8080, 8443]
},
"debug": false
}Good to know
- Comments are discarded, because JSON has no way to express them.
- Only the first document of a multi-document stream is converted; the tool tells you when more are present.
- YAML supports non-string mapping keys and custom tags; those cannot be represented in JSON and are rejected with an explanation.
Frequently asked questions
Why does my file fail on a tab character?
YAML explicitly forbids tabs for indentation, because tab width is ambiguous. Replace leading tabs with spaces and the document will parse.
What happens to anchors and aliases?
They are resolved during parsing, so the JSON contains the expanded value at every alias site. The sharing is lost, which is expected — JSON has no reference mechanism.
My value became true instead of a string. Why?
Bare yes, no, on and off are parsed as booleans in many YAML dialects. Quote the value in the source to keep it a string.
Can it handle files with multiple documents?
It detects them and converts the first. Split the stream on --- and convert each part separately if you need all of them.
Your data stays on your device
Your data is processed locally in your browser and is not uploaded to our server. This page keeps working after you go offline, because there is nothing to send.