json:yaml

YAML validator

Check your YAML for syntax errors — and read the normalised output, because most YAML bugs are files that parse cleanly and mean the wrong thing.

YAML
YAML

      
Paste YAML to convert.

Conversion happens in this browser tab. Nothing is uploaded, logged, or stored.

What is being checked

Your document is parsed with a YAML 1.2 parser. Syntax errors are reported with a line and column, and where the underlying message is cryptic it is translated into something you can act on. If the document parses, you get the normalised YAML back — which is worth reading, because seeing how the parser understood your file often reveals a structural mistake that was never a syntax error at all.

That is the difference between a YAML validator and a JSON one. Most YAML bugs are not invalid files. They are valid files that mean something other than what the author intended: a list item indented one space too far, a value that became a boolean, a key that ended up nested under its sibling.

Common failures and their fixes

A tab character is not allowed

YAML forbids tabs in indentation. The file will look correctly aligned in your editor and still fail. Convert tabs to spaces and set your editor to insert spaces for YAML files.

Bad indentation of a mapping entry

Two sibling keys at different indentation levels, which the indentation rules cover in full. Every key in the same mapping must start at the same column — not "roughly aligned", exactly the same.

Duplicated mapping key

The same key appears twice in one mapping. JSON tolerates this and keeps the last value; strict YAML rejects it. This is a common result of a bad merge.

Could not find expected ':'

Usually an unquoted value containing a colon, or a line that was meant to be a list item but is missing its hyphen.

Mapping values are not allowed in this context

A colon appears inside a plain scalar where the parser is not expecting one. Quote the value.

Found unexpected end of stream

An opening quote or bracket has no partner. This is one of the messages that points at the wrong place: the parser reads to the end of the file before it can be sure anything is wrong, so it reports the final line. Search upwards for a line with an odd number of quotes.

Valid but wrong

Some documents parse cleanly and still ruin your day. A syntax validator cannot catch them, so check the parsed output.

You wroteThe parser saw
country: NOBoolean false, under YAML 1.1 parsers
version: 1.10The float 1.1
port: 0755Octal 493, under YAML 1.1
time: 12:30A sexagesimal number, under YAML 1.1
value: null vs value:Both null — an empty value is not an empty string
sha: 1e5The float 100000

The fix in every row is the same: quote the value. When in doubt about a scalar that is meant to be text, quote it.

Once it parses, the YAML formatter will normalise the indentation, and converting to JSON is a quick way to see the structure the parser actually built.

Validating in a pipeline

# yamllint catches style problems as well as syntax
pip install yamllint
yamllint -d relaxed .

# parse-only check, no extra tools
python -c 'import sys,yaml; yaml.safe_load(open(sys.argv[1]))' config.yaml

# schema-aware, for Kubernetes manifests
kubectl apply --dry-run=client -f manifest.yaml

Your broken file stays yours

The YAML that will not parse is usually the one pulled straight off a production cluster, secrets and all, at the moment a deploy failed. Nobody sanitises a file before pasting it into a validator at that point.

So this one does not need sanitising. The parser runs in your browser tab. Your document is not uploaded, not logged, and not retained — there is no server-side step in which any of that could happen.

Questions people ask

Why does my YAML fail with a tab error?
YAML forbids tab characters in indentation. The file will look correctly aligned in your editor and still fail. Convert tabs to spaces and configure your editor to insert spaces for .yaml files.
What does 'bad indentation of a mapping entry' mean?
Two keys that should be siblings start at different columns. Every key in the same mapping must begin at exactly the same column, not approximately.
My YAML is valid but the values are wrong. Why?
Unquoted scalars get type inference applied. 1.10 becomes 1.1, NO can become false, and 07030 can become octal. Quote any value that is meant to be text.
Which YAML version is used?
YAML 1.2. Be aware that some tools still ship 1.1 parsers, where yes/no/on/off are booleans and leading zeros mean octal. Quoting protects you under both.
Can this validate a Kubernetes manifest?
It checks YAML syntax, not Kubernetes schema. For schema validation run kubectl apply --dry-run=client -f manifest.yaml.
Does it check for duplicate keys?
Yes. Duplicate keys in one mapping are reported as an error, which is stricter than JSON — JSON parsers usually keep the last one silently.