A YAML converter that shows you the Norway problem

YAML is a format where the value NO can become the boolean false, where an unquoted version number can become a float, and where a stray tab is a fatal error the message does not name. Converting to JSON is the fastest way to see what a parser actually made of your file.

Open the YAML Converter →

Online YAML Tools and Softland, side by side

 Online YAML ToolsSoftland
YAML to JSONYesYes
JSON to YAMLYesYes
Validation while typingOn conversionAs you go, with the position of the failure
Where the config is processedVariesIn your browser
CommentsLost in conversion to JSONLost in conversion to JSON - JSON has none

Converting to JSON is a diagnostic, not just a conversion

When a deployment fails on a config file, the error is usually from something several layers away from the parser - a schema validator complaining that a field is the wrong type, or an application reading a key as empty. Converting the YAML to JSON collapses all of that into one view: here is what a parser actually built from your file, with every type it inferred made explicit.

Nine times out of ten the answer is visible immediately. A value you meant as a string is a number. A key you thought was nested is a sibling because the indentation was two spaces where the surrounding block used four. A list is a single string because the dash had no space after it.

The Norway problem, and its relatives

In YAML 1.1, the unquoted tokens yes, no, on, off, y and n are booleans. A list of country codes containing NO for Norway becomes a list containing false. This is the most famous example, and it has a family: 1.20 as a version number becomes the float 1.2 and loses its trailing zero, a time like 12:30 becomes a sexagesimal integer in some parsers, and a value starting with a zero may be read as octal.

The defence is boring and reliable: quote anything that is not obviously a number you want arithmetic on. Version strings, country codes, postcodes, times, identifiers, and anything a human will compare by eye. YAML 1.2 narrowed the boolean rule, but the parser your tooling uses may well not be a 1.2 parser, and the failure is silent either way.

Tabs, and why the error never says tab

YAML forbids tabs for indentation outright. An editor configured to insert tabs, or a block pasted in from somewhere that used them, produces a file that looks correctly aligned and will not parse - and the error typically points at a line some distance from the tab, describing a mapping value that is not allowed here.

If a file looks right and refuses to parse, check for tabs before checking anything else. The second thing to check is trailing whitespace after a colon, and the third is a line that mixes indentation depths within one block. Those three account for most of the parse errors that survive a careful read.

When Online YAML Tools is the better choice

  • You need conversion to formats beyond JSON - XML, TOML, CSV, properties files - which a broader toolkit covers.
  • You want to validate against a JSON Schema rather than check syntax.
  • You want to run the same conversion from the command line or a script, where a page is the wrong shape.

Frequently asked questions

Is my configuration file uploaded?
No. Parsing and conversion happen in your browser, which matters because config files routinely contain hostnames, usernames and occasionally a secret that should not have been committed.
Why does my YAML fail to parse?
In order of likelihood: a tab used for indentation, inconsistent indentation within a block, a missing space after a colon or a dash, or an unquoted string containing a colon. The reported line is often below the real cause.
Why did NO become false?
Older YAML treats yes, no, on, off, y and n as booleans when unquoted. The country code for Norway is the classic casualty. Quote any value that is meant to stay a string.
Do comments survive conversion to JSON?
No, because JSON has no comments. Anything explanatory in a YAML file is lost on the way across, which is worth remembering before converting a config you intend to keep maintaining.

Try it yourself

YAML to JSON and back.

Open the YAML Converter

Online YAML Tools is a trademark of its respective owner. Softland is not affiliated with, endorsed by or sponsored by Online YAML Tools. This comparison reflects how each product works rather than what either costs, because pricing and plan limits change; check Online YAML Tools’s own site for its current terms.