YAML to JSON Converter
Convert YAML to JSON in your browser, with a choice of indent or minified output and clear parse-error messages. Anchors and aliases are expanded.
YAML is a superset of JSON, so anything valid here maps cleanly to a JSON value. Comments are dropped (JSON has none), anchors and aliases are expanded to plain data, and dates become ISO strings. Multi-document YAML (streams separated by ---) is not supported — this converts a single document. Parsing happens entirely in your browser.
YAML and JSON: the same data, different clothes
JSON and YAML describe the same three things — mappings, sequences and scalars — so any YAML document that holds plain data has an exact JSON equivalent. JSON is in fact a strict subset of YAML. This converter parses the YAML into an in-memory value and re-serialises it as JSON, which is why round-tripping data through it is lossless for anything JSON can represent.
What does not carry over is everything JSON lacks a slot for. Comments are the big one: YAML "#" comments are stripped because JSON has no comment syntax. Anchors and aliases (&x / *x) are resolved — the JSON gets a full copy wherever the alias appeared, not a reference. Custom tags (!!python/object and the like) are not supported and will error.
Scalar interpretation follows the core schema. true and false are booleans; the YAML 1.1 habit of treating yes, no, on and off as booleans is not applied, so those stay strings. A bare number is a number, a bare date-like value is parsed and then written back as an ISO 8601 string (JSON has no date type), and everything else is a string. Quote a value in the YAML if you need to force it to stay text.
Two common errors: YAML forbids tab characters for indentation — use spaces — and this tool converts a single document, not a multi-document stream separated by "---". The parser reports the line and column of a syntax error so you can find it quickly.
Parsing and serialising run entirely in your browser via the js-yaml library. Nothing you paste is uploaded, and the tool works offline once loaded.
Related tools
These free tools pair well with this page — open them in a new tab to finish your workflow.
Frequently Asked Questions
Is every YAML file convertible to JSON?
Every YAML document that represents plain data (mappings, sequences, scalars) converts cleanly, because JSON is a subset of YAML's data model. What does not survive the trip is anything JSON has no concept of: comments are dropped, and custom YAML tags will fail or be coerced.
What happens to comments?
They are removed. JSON has no comment syntax, so the # comments in your YAML cannot be represented and are discarded during parsing.
How are anchors and aliases handled?
They are resolved. A value defined with &anchor and reused with *alias is expanded so the JSON contains a full copy at each place the alias appeared. The reference itself is not preserved.
What about dates and other special scalars?
A YAML timestamp is parsed to a date and then serialised as an ISO 8601 string in the JSON, since JSON has no date type. "yes"/"no"/"on"/"off" are treated as strings by the default schema, not booleans — only true/false are booleans.
Does it support multi-document YAML?
No. YAML streams that contain several documents separated by --- are not supported here; the tool converts a single document. Split the stream and convert each part separately.
Why do I get a parse error on tab characters?
YAML forbids tabs for indentation — only spaces are allowed. If your file was indented with tabs, replace them with spaces and it will parse. The error message shows the line and column.
Is my data uploaded?
No. Parsing and serialising happen entirely in your browser with the js-yaml library. Nothing is sent to a server.