YAML to JSON Converter
Validate YAML indentation and convert simple YAML documents to JSON with line-numbered errors.
Paste YAML to check its indentation and structure, then convert it to JSON. Supports flat mappings, one level of nested mappings, and flat lists of scalars, with proper typing of numbers, booleans, and nulls. Anything outside the supported subset — tabs, deep nesting, multi-line scalars — gets a clear error with a line number instead of a wrong result.
How to use this calculator
- Paste your YAML into the input box (spaces for indentation, no tabs).
- Choose Convert to JSON, or Validate only to just check the structure.
- Click Convert.
- If there is an error, fix the indicated line and try again.
- Copy the resulting JSON into your code or config pipeline.
The formula
Lines are split into indentation level plus content; a recursive parser builds mappings and lists while enforcing consistent indentation and the one-level nesting limit; scalars are typed as number, boolean, null, or string before JSON serialization.
Worked example
Converting name: Ada Lovelace, age: 36, a nested address block with city and zip, and a tags list yields JSON with "age": 36 as a number, the address as a nested object, and tags as an array of strings — verified by parsing the output back in tests.
Frequently Asked Questions
What YAML features are supported?
Flat key-value mappings, one level of nested mappings, flat lists of scalars, comments, and typed scalars (numbers, booleans, null, quoted strings). That covers the vast majority of config files, CI definitions, and front-matter people actually need to convert.
What is NOT supported?
Multi-line scalars (| and >), anchors and aliases (& and *), flow collections ({a: b} and [1, 2]), tab indentation, and nesting deeper than one level. These produce explicit errors naming the line, so you always know why a document was rejected rather than getting silently wrong JSON.
Why does it reject tabs?
The YAML specification itself forbids tabs for indentation — this is one of the most common YAML errors across every parser, not just this tool. Replace tabs with spaces (two per level is the convention) and the document will validate.
How are values typed in the JSON output?
Unquoted 36 becomes the number 36, true/false become booleans, and null/~ become null. Anything else stays a string, with single and double quotes stripped. If you need a value to remain a string, quote it in the YAML.
Does my YAML leave the browser?
No — parsing and conversion happen locally. Config files often contain secrets or internal hostnames, so nothing is uploaded anywhere.