YAML to JSON
Convert YAML to JSON. Maps, lists, flow style, literal and folded blocks, anchors with aliases and merge keys, and multiple documents separated by --- are supported.
Use the tool
Why this tool exists
YAML is easy to write and easy to get subtly wrong. When a CI pipeline, a Kubernetes manifest or an application config misbehaves, converting it to JSON shows what a parser really sees: which values are numbers, which are strings, and what an anchor or merge key expanded to.
Paste the YAML and the tool gives you the equivalent JSON with your chosen indent. Anchors and aliases are resolved, merge keys are applied, and block scalars are turned into strings. This is useful for validating a file, feeding YAML data to a tool that only reads JSON, or comparing two files in a stable form. It covers the commonly used part of YAML rather than the full specification. Nothing is uploaded.
How to use it
- Paste your YAML into the input box.
- Choose the indent for the JSON output.
- Read the JSON, with anchors, aliases and merge keys already expanded.
- Copy the result, or fix the YAML error shown.
Frequently asked questions
Does it support the whole YAML specification?
No. It handles the common subset: block and flow maps and lists, quoted and plain scalars, literal and folded blocks, anchors, aliases, merge keys and multiple documents. Rare features such as custom tags may not work.
What happens with multiple documents?
Documents separated by lines containing three dashes are returned together as one JSON array, with one item per document, so nothing from later documents is lost.
Why did my value become a string or a number?
Plain YAML values are typed by their look: 1.2 is a number, true is a boolean, ~ is null. Quote a value to force a string, for example "1.20" or "no".
Are comments kept?
No. JSON has no comments, so they are dropped. Use the YAML Formatter if you only want to tidy the YAML, noting that it also drops comments.