To YAML or not to YAML, that is the question

icarusz3 pts0 comments

In Defense of YAML :: Posit Open Source

Blog

May 21, 2026

Best Practices

In Defense of YAML

A common refrain among developers: YAML is bad and TOML is good. This post argues otherwise, tracing the history of configuration formats, examining what YAML 1.2 actually fixed, and introducing py-yaml12, a new Rust-backed Python library for working with the modern spec

Read more...

Rich Iannone,Tomasz Kalinowski

Every programmer has opinions about configuration files. These opinions<br>tend to be strongly held and inversely proportional to the stakes<br>involved. In the last few years, the consensus view has shifted: YAML is<br>bad, TOML is good, and enthusiastic users of YAML just might be plainly<br>uninformed. This post takes a different view. We intend to present an<br>argument for YAML which is grounded in history, its specification, and<br>the state of tooling in 2026.

The case against YAML was, for a long time, a reasonable one. The format<br>attracted its critics for real reasons, through years of surprising<br>behavior that burned even careful users. But the specification evolved,<br>and the tooling is finally catching up. To understand why the current<br>consensus is outdated, we need to trace the lineage of configuration<br>formats themselves, because this sort of argument has played out before.

A brief history of configuration formats#

The INI file emerged in the early 1980s alongside MS-DOS and the first<br>versions of Windows.1 It was the simplest thing that could possibly<br>work: key-value pairs, grouped into sections denoted by square brackets,<br>with semicolons for comments. They are flat, readable, and<br>human-editable. For the needs of that era (like configuring device<br>drivers, specifying font paths, or setting application preferences) it<br>was entirely adequate. Its only real limitation was structural: you<br>could not nest deeper than one level, and there was no formal<br>specification, which meant every parser implemented its own dialect. But<br>for two decades, this was fine.

[boot]<br>shell=COMMAND.COM<br>device=HIMEM.SYS

[display]<br>resolution=640x480<br>colors=256

Then came XML. In the late 1990s, the enterprise software world adopted<br>angle brackets broadly. XML could represent arbitrary hierarchy. It had<br>schemas, namespaces, transformations. It was self-describing. For a<br>while it seemed as though the debate was settled. But XML configuration<br>files grew large in practice. Anyone who maintained a Java web.xml or<br>an Ant build file in 2003 knows what it was like to edit dozens of<br>nested elements just to change a database connection string. The<br>verbosity made the files difficult to maintain by hand, which is<br>precisely what configuration files demand.

myServlet<br>com.example.MyServlet

database.url<br>jdbc:postgresql://localhost/mydb

JSON appeared as the lightweight reaction. Douglas Crockford, who claims<br>to have discovered rather than invented the format,2 offered the<br>simplicity of the JavaScript object literal: curly braces, square<br>brackets, quoted strings, and a tiny set of types. JSON displaced XML in<br>web APIs through the late 2000s and early 2010s. But as people began<br>using it for configuration (rather than machine-to-machine data<br>exchange), its limitations became apparent. JSON has no comments. It has<br>no multiline strings. Trailing commas are illegal. These are reasonable<br>constraints for a serialization format, but they make JSON miserable for<br>files that humans must author and maintain. The removal of comments from<br>JSON&rsquo;s spec was, according to Crockford himself, motivated by people<br>abusing them for parsing directives.3 It was the right call for data<br>interchange, but it left a gap.

YAML (2001) and TOML (2013) each arose to fill that gap, and both<br>positioned themselves explicitly against what came before. YAML offered<br>the full expressive power of a serialization language (including<br>arbitrary nesting, multiple documents, references, and custom types)<br>with a syntax built on indentation rather than brackets. TOML, created<br>by Tom Preston-Werner a dozen years later, was a reaction to YAML&rsquo;s<br>complexity: it aimed to be a &ldquo;standardized INI&rdquo; with explicit typing,<br>obvious semantics, and a formal specification.4 The pattern repeats<br>in each generation: the previous format&rsquo;s excess becomes the new<br>format&rsquo;s founding grievance. What is interesting about the current<br>moment is that YAML&rsquo;s problems were not inherent to the format&rsquo;s design.<br>They were artifacts of a particular specification version and the<br>parsers frozen on it.

The case against YAML (as it was)#

The criticisms of YAML are not fabricated. They reflect real experiences<br>that real programmers had over many years.

The most infamous problem is the Norway incident, which has become<br>shorthand for YAML&rsquo;s implicit typing behavior. In YAML 1.1, the bare<br>scalar NO was interpreted as the boolean value false. This meant<br>that a list of country codes would silently transform Norway into a<br>falsehood:

# What you wrote:<br>countries:<br>- dk<br>- fi<br>- is<br>- no<br>-...

yaml configuration rsquo format files specification

Related Articles