About the YAML to JSON Converter tool
YAML is pleasant to write but easy to break: a single wrong indent or a tab character can change the meaning of a whole file or make it fail to load. This YAML to JSON converter parses your YAML with js-yaml and shows the equivalent JSON as you type, which is both a quick way to convert config files and an effective YAML validator. If there is a problem, you see the parser’s message together with the exact line and column.
The converter understands comments, anchors and aliases, merge keys (<<: *defaults, as used in Docker Compose and CI files), block and flow styles, and multi-line strings using | and >. It follows the modern YAML 1.2 core schema, so words like yes and no stay strings instead of silently turning into booleans, and dates stay as text. Files that contain several documents separated by --- are converted into a JSON array with one element per document. You can choose 2 spaces, 4 spaces or tabs for the JSON output.
Everything happens in your browser. Pipeline files, cloud configs and secrets templates are never uploaded, so it is safe to paste real infrastructure code.
How to use YAML to JSON Converter
- Paste YAML into the “YAML input” box, open a .yaml or .yml file with “Open file”, or click “Load sample”.
- Pick the “JSON indent”: 2 spaces, 4 spaces or tab, and leave “Expand merge keys (<<)” on unless you want << kept as a literal key.
- Read the JSON output on the right; if the YAML is invalid, the error shows the line and column.
- Fix any reported problem in the input and the output updates automatically.
- Click “Copy” or “Download” to save a .json file.
Features
Line-accurate validation
Syntax errors show the exact line and column reported by the YAML parser.
Full YAML support
Handles comments, anchors, aliases, merge keys, block scalars and flow collections.
Multi-document files
Documents separated by --- become items of a JSON array.
YAML 1.2 semantics
Avoids the classic “Norway problem” by keeping yes, no and on as strings.
Choose indentation
Output JSON with 2 spaces, 4 spaces or tabs.
When to use it
- Validate a Kubernetes, Helm or Docker Compose file before deploying it.
- Convert an OpenAPI YAML spec to JSON for tools that only read JSON.
- Debug a GitHub Actions or GitLab CI workflow that fails to parse.
- Load YAML configuration into a JavaScript app as JSON.
- See exactly how anchors and aliases expand in a complex config.
Frequently asked questions
Why does my YAML show an indentation error?
YAML uses spaces to define structure and does not allow tab characters for indentation. Check the line number in the error for mixed tabs, uneven spaces or a missing colon.
How are anchors (&), aliases (*) and merge keys (<<) handled?
Each alias is replaced by a copy of the anchored value. With “Expand merge keys (<<)” on (the default), <<: *anchor copies the keys of the anchored mapping into the current one, keys written locally override the merged values, and <<: [*a, *b] merges several mappings. Turn the switch off to keep << as an ordinary key.
What happens with multiple documents separated by ---?
Each document becomes one element of a JSON array. A file with a single document is output as that document alone.
Will “yes” or “on” become true?
No. The converter follows the YAML 1.2 core schema, where only true and false are booleans. Dates are also kept as strings.
Are YAML comments kept?
No. JSON has no comment syntax, so comments are dropped during conversion.
Is my YAML sent to a server?
No. Parsing happens entirely in your browser.