YAML in
JSON out
Mappings, sequences, flow collections, block scalars, anchors, aliases and merge keys are all handled. Not handled, and reported rather than guessed at: more than one document in a file; explicit tags such as !!str or !Ref; complex mapping keys written as ? key; plain scalars continued across several lines.
About YAML to JSON Converter
YAML and JSON describe the same shapes — mappings, lists and scalars — so anything written in one can be written in the other. What differs is everything around the data: YAML has comments, anchors, block text and inferred types, and JSON has none of them.
This converter goes both ways. Paste YAML and get JSON with the types resolved the way a YAML reader would resolve them; paste JSON and get block YAML with every string quoted that needs quoting. Parse failures name the line rather than saying the file is invalid and leaving you to find out where.
It runs entirely in your browser. Config files are the one category of text most likely to contain a live credential, and the safest place to convert one is a page that has nowhere to send it.
- Converts YAML to JSON and JSON to YAML
- Parse errors pinned to the line that caused them
- Anchors, aliases and merge keys expanded
- Block scalars, flow collections and comments understood
- Warns before comments are dropped
- Runs in your browser — nothing is uploaded
How to use YAML to JSON Converter
Pick a direction
YAML to JSON, or JSON to YAML. The panels and the sample change with it.
Paste your file
A whole config or a fragment. Indentation is read as written, so paste it exactly as it appears in the file.
Read any warning above the result
Comments that cannot survive the trip to JSON are counted and reported before you copy anything.
Send the result back to check it
One button feeds the output into the input and flips the direction, so you can see whether a round trip gives you what you started with.
What YAML this converter supports
Block mappings and sequences nested by indentation, sequences written flush with their key, and compact mappings inside a list item. Flow collections in braces and brackets, including ones wrapped across several lines. Plain, single-quoted and double-quoted scalars with the full escape set. Block scalars in both literal and folded form, with chomping indicators and explicit indentation. Comments anywhere they are legal. Anchors, aliases and merge keys.
Four things it deliberately refuses rather than guesses at: more than one document in a file, explicit tags such as !!str or !Ref, complex keys written as ? key, and plain scalars continued across several lines. Each of those is reported with its line number, so you know exactly what to change.
The type rules are YAML 1.2's core schema, which is what Go, Rust and every current parser implement. The practical consequence is that yes, no, on and off stay strings. Under the older 1.1 rules the country code NO became false — the Norway bug — and a converter that reproduced it would be a liability rather than a convenience.
Common YAML errors and what they mean
A tab in the indentation. YAML forbids tabs there entirely, and because a tab and a run of spaces look identical in most editors this is the error people stare straight past. It is reported with the line so you can retype that one indent.
Inconsistent indentation. Every key in a mapping has to sit at the same column, and a line that is deeper than the key above it without opening a nested structure has no meaning. The error names the offending line rather than the line where the structure started.
A missing space after the colon. In YAML the colon only ends a key when whitespace follows it, which is exactly what lets url: https://example.com hold a value containing a colon. Write key:value with no space and the whole thing is one plain scalar, not a mapping.
Duplicate keys. Two identical keys in the same mapping are an error in the spec and silently last-wins in some readers, which is how a setting ends up being ignored for months. This converter stops and tells you which key is repeated.
Converting JSON to YAML: what gets quoted and why
YAML infers types from how a scalar is written, so the emitter has to quote any string that could be read as something else. A string of digits, the words true and null, anything beginning with an indicator character such as - or *, anything with leading or trailing spaces, and anything containing a colon followed by a space all come out quoted.
It also quotes the 1.1 words yes, no, on and off even though this parser would read them back as strings. The output has to survive whatever reads it next, and plenty of tooling still applies the older rules.
Strings with newlines in them are written as literal block scalars, which is what makes an embedded shell script or certificate readable rather than one enormous line of escapes. A string whose lines end in spaces is the exception: block form would lose that trailing whitespace silently, so those fall back to a quoted single line.
Is it safe to paste a production config here?
The parsing, the conversion and the formatting all happen in your browser. The page makes no request with your input and there is no server to make one to — you can close the network tab and watch nothing happen.
That said, a deployment config is the most credential-dense file most teams have. If the one you are converting contains a live key, treat pasting it into any web page the way you would treat pasting it into a chat window, and rotate the key if you are unsure.
Frequently asked questions
What happens to my comments?
JSON has no way to represent a comment, so converting YAML to JSON drops them. The tool says so rather than letting you discover it afterwards, because a config file's comments are often the only documentation it has.
Why did my version number become a decimal?
YAML infers types, so an unquoted 1.20 is a number and loses its trailing zero. Quote it in the source if it is meant to be a string. This is the single most common surprise when converting YAML, and it is YAML's behaviour rather than this tool's.
Are anchors and aliases supported?
They are expanded, so each alias becomes a full copy of what it referenced. That is the only faithful way to express them in JSON, which has no equivalent — but it does mean the output can be larger than the input.
Related tools
Last updated 19 Aug 2026 · Free to use · Runs entirely in your browser