Skip to main content

Interactive tool

Why that file will not parse

The line, the column, and what actually broke — in a sentence rather than “unexpected token”. Converts between YAML and JSON once it parses.

Runs in your browser · nothing is sent anywhere

Try

Nothing is sent anywhere — the parser is part of this page and runs in your browser. Even so, a manifest often names registries, namespaces and occasionally a secret, so it is worth removing values you would not paste into a terminal you do not own.

What YAML and JSON are for

Both are ways of writing structured data as text: a list of things, a thing with named properties, a number, a string. Programs read them to find out how they should behave.

JSON came from JavaScript and is strict — every key in double quotes, commas between items, no comments, exactly one value per file. YAML was designed to be written by hand, so it uses indentation instead of braces, allows comments, and does not need quotes most of the time.

That flexibility is why YAML won for configuration and why it fails in more interesting ways. Almost everything that goes wrong with a YAML file is the parser reading something you did not mean, rather than rejecting something obviously broken.

Using it

Paste the file. The format is detected from the first character — a { or [ means JSON — and you can override that if the guess is wrong.

When it fails you get the line, the column, the offending line with a caret under it, and a sentence about the cause. The parser's own message is kept behind a disclosure, because it is the thing to search for when the explanation does not fit.

When it parses, both formats are rendered side by side, so this is also the conversion. The examples include broken files on purpose — the error messages are the part worth trying.

The failures worth knowing about

Norway. Unquoted no, yes, on and off were booleans in YAML 1.1, so a country code of NO could arrive as false. YAML 1.2 removed that, but parsers differ in which version they implement, and the value is wrong rather than rejected. Quote anything whose type matters.

Leading zeros. 08 is a number in some schemas and an error in others that read it as octal. A version string like 1.10 is a float that becomes 1.1. Both are silent.

Duplicate keys. A mapping with the same key twice is invalid YAML, but many parsers keep the last one quietly, so a merged file can lose a setting without complaint.

The pattern in all three is that the file parses and the value is wrong. Validation catches the syntax; only reading the parsed output — the JSON pane here — catches these.

Questions people ask about this

Why does my YAML fail with “bad indentation of a mapping entry”?

Two different mistakes produce that message, which is why it is confusing. One is genuinely misaligned indentation. The other is a colon inside a value you did not quote.

message: error: connection refused is the second kind. YAML reads the first colon as the key separator and then finds a second one, so it thinks a nested key has started at the wrong column. Quoting the value fixes it: message: "error: connection refused".

This page checks the marked line before choosing which explanation to lead with, so you are not sent to inspect indentation that was never the problem.

Can I use tabs to indent YAML?

No. The specification forbids tab characters in indentation, and parsers reject them outright rather than guessing a width. Only spaces count. This is worth knowing because an editor configured to insert tabs produces a file that looks correctly aligned and will not parse anywhere.

Why does JSON reject my trailing comma when YAML accepts it?

Because the JSON specification has no trailing commas, and it is strict by design — there is deliberately no dialect to negotiate. A comma after the last item promises another item, so the parser fails at the closing brace rather than at the comma itself, which is why the reported position is often the line after the mistake.

Several things that look like JSON do allow them — tsconfig.json and VS Code's settings are JSON with Comments, not JSON. If a file with comments or trailing commas has to be read by a strict parser, it will need converting first.

What happens to a multi-document YAML file when I convert it to JSON?

It becomes a JSON array. JSON holds exactly one value and has no equivalent of YAML's --- separator, so the only faithful representation of several documents is a list of them. Converting that array back to YAML restores the separators. Kubernetes manifests commonly ship several objects in one file, so this comes up more than the format difference suggests.

Is my configuration sent to a server?

No. Both parsers ship as part of this page and run in your browser, so there is no endpoint for the text to reach and the network tab will show no request when you type. Worth adding that this is a statement about where the parsing happens, not permission to be careless: a manifest often names registries and namespaces, and sometimes carries a secret, so it is still worth stripping values you would not paste into a terminal you do not own.

Did this get you to an answer?

No text box on purpose — please do not paste production logs anywhere