YAML to JSON

Convert YAML to JSON and validate it at once - clear line-numbered errors when the YAML is malformed. Runs entirely in your browser.

Convert and validate in one step

YAML is lovely to write but fiddly to get exactly right - a single stray space or a sneaky tab can change the meaning or break parsing entirely. Paste your YAML above and it is turned into JSON the instant you stop typing. If it converts cleanly it was valid; if not, you get the precise line and column of the first error instead of a vague failure.

Why the line number matters

Most YAML mistakes are structural: a list item indented under the wrong key, a value that should have been quoted, or a tab used where spaces are required. The parser reports exactly where it gave up, and the caret preview above points at that character - far quicker than re-reading the whole file. Remember YAML never allows tab characters for indentation, so a copied snippet with tabs will always be flagged.

Multiple documents

One YAML file can hold several documents separated by a --- line, which Kubernetes uses constantly to bundle related resources. When the tool sees more than one, it returns a JSON array with one entry per document and notes the count, so nothing is quietly lost. Switch between Pretty and Minified output depending on whether you want something readable or something compact.

Going the other way? Use the JSON to YAML converter. To tidy the result, reach for the JSON formatter, or convert a legacy feed with the XML to JSON converter.

Frequently asked questions

Does it validate my YAML?
Yes. Converting is validating - if the YAML parses, it is valid. If it does not, you get a clear message with the exact line and column of the first problem, which is usually a bad indent, a tab character or a mis-aligned list item.
Why does YAML reject tab characters?
The YAML spec forbids tabs for indentation because their width is ambiguous, so structure would be unreliable. Use spaces instead. If you paste tab-indented YAML you will see an error pointing at the offending line.
What about a file with multiple documents?
YAML lets you separate several documents in one file with a --- line. When that happens this tool returns a JSON array with one element per document, and tells you how many it found, so nothing is silently dropped.
What is the difference between pretty and minified output?
Pretty output is indented across multiple lines so it is easy to read. Minified output strips all optional whitespace into a single line, which is smaller for storage or transport. Both contain identical data.
Is my YAML uploaded anywhere?
No. Parsing and conversion happen entirely in your browser with JavaScript. Nothing you paste leaves your machine.