YAML to JSON Converter
Paste YAML and get the equivalent JSON. Anchors and aliases are resolved, multi-line strings are kept intact, several documents in one file are combined into an array, and any syntax error is shown with its line number.
- Runs in your browser
- No sign-up
- Free to use
How to use YAML to JSON
- Paste YAML into the left pane or open a .yaml or .yml file.
- Choose the indentation of the JSON output.
- Select Convert to JSON.
- Copy the JSON or download it as a file.
YAML to JSON features
Full YAML 1.2 parsing
Mappings, sequences, flow style, block scalars, quoted strings, comments and typed values.
Anchors and merge keys
Anchors (&), aliases (*) and merges (<<) are expanded into plain data.
Multiple documents
Files with --- separators are converted into a JSON array with one entry per document.
Doubles as a validator
If the YAML is invalid, the message names the line and the reason.
Honest about edge cases
Values JSON cannot express, such as .nan, are written as null and mentioned in the result.
Stays on your device
Configuration files often contain secrets; nothing is uploaded.
When to use YAML to JSON
- Checking what a Docker Compose, Kubernetes or CI configuration file really contains after anchors are resolved.
- Finding an indentation mistake in a YAML file.
- Feeding YAML configuration into a tool or API that expects JSON.
- Converting OpenAPI definitions from YAML to JSON.
YAML to JSON FAQ
Is every YAML file convertible to JSON?
Almost. JSON is close to a subset of YAML, so ordinary data converts exactly. The exceptions are YAML features with no JSON counterpart: comments are dropped, anchors are expanded, keys that are not strings are turned into strings, and special numbers such as .inf become null.
Why did “no” or “on” not become a boolean?
This converter follows YAML 1.2, in which only true and false are booleans. Older YAML 1.1 parsers also treated yes, no, on and off as booleans, a notorious source of bugs such as the country code NO turning into false. If your tool uses YAML 1.1 rules, quote such values to be safe.
What happens to dates?
Unquoted timestamps such as 2024-03-15 are recognised as dates and written in ISO format with a time, for example "2024-03-15T00:00:00.000Z". Put quotes around the value in the YAML if you want it kept exactly as text.
What are anchors and aliases?
An anchor (&name) marks a value so that it can be reused elsewhere with an alias (*name). The merge key << copies the keys of an anchored mapping into another mapping. JSON has no such mechanism, so the converter writes the repeated values out in full.
How do I find an error in my YAML?
Convert it. If parsing fails, the message gives the line and what the parser expected, and the line is marked in the editor. The most frequent causes are inconsistent indentation, tabs used for indentation, and a missing space after a colon.
Can I convert several YAML documents at once?
Yes. A file that contains multiple documents separated by --- is converted to a JSON array, with each document as one element.
Why convert YAML to JSON
YAML is written for people. It uses indentation instead of brackets, allows comments, and lets you avoid repetition with anchors. Those conveniences are why it dominates configuration files for containers, deployment pipelines and infrastructure tools. They are also why YAML files go wrong in ways that are hard to see: a value indented one space too far ends up under a different key, and nothing looks broken.
JSON removes the ambiguity. Every structure is explicit, with braces around objects and brackets around lists, so converting a YAML file to JSON shows exactly how a parser understood it. If a key appears nested where you expected it at the top level, the indentation in the YAML is off. If a value shows up as a string instead of a number, or as a boolean instead of a word, the YAML typing rules have applied in a way you did not intend.
Typing is the subtle part of YAML. An unquoted value is interpreted: 8080 is a number, true is a boolean, 1.10 is the number 1.1, and a version such as 3.10 silently loses its trailing zero. Quoting forces a string. Seeing the JSON output makes these interpretations visible, since strings have quotation marks and other types do not.
Conversion also serves a practical purpose in toolchains. Many programs and APIs accept only JSON, and nearly every language can read it without extra libraries. Keeping the human-edited source in YAML and generating JSON from it combines the readability of one with the universality of the other.