YAML 01 ๐ Introduction to YAML โ Where It Came From and Where It’s Used
YAML is a human-readable data serialization language. That definition is precise: it is not a programming language, not a markup language, and not a document format. It exists to represent structured dataโmaps, lists, scalarsโin a form that a person can read and edit without special tooling, and that a machine can parse deterministically. The name is a recursive acronym: “YAML Ain’t Markup Language,” a deliberate retronym that replaced the original “Yet Another Markup Language” once the creators decided the emphasis should be on data, not documents .
This chapter covers the origins of YAML, the problems its creators were reacting to, and the tools that made it ubiquitous. It explains why a format designed for data serialization became the configuration language of Kubernetes, Docker Compose, Ansible, and CI/CD pipelines, and why its syntax choicesโindentation, minimal punctuation, anchorsโmatter for both readability and failure modes.
Key point: YAML is a data serialization language that prioritizes human readability; its adoption by infrastructure tools is a consequence of that readability, not a design goal.
Why YAML exists
The XML verbosity problem. YAML emerged in 2001 from two converging efforts. Clark Evans and Oren Ben-Kiki were working on simplifying XML within the sml-dev group; Ingy dรถt Net had built a Perl module called Data::Denter for serializing data structures. Their visions were similar, and within days of the first public YAML draft on 12 May 2001, they collaborated and YAML was born . The shared motivation was XML’s verbosity: angle brackets, closing tags, and attribute syntax made structured data tedious to read and write by hand. YAML’s answer was to remove almost all punctuation and use indentation to express nesting, borrowing the idea from Python .
The “markup versus data” distinction. The original name, “Yet Another Markup Language,” placed YAML in the lineage of HTML and XML. The creators renamed it to “YAML Ain’t Markup Language” to signal that YAML does not mark up documents; it serializes data . This distinction matters because it explains the syntax: no tags, no attributes, no document structure beyond what the data itself requires. A YAML file describes a map or a list, and the indentation shows which keys belong to which values.
The readability trade-off. YAML’s readability comes at a cost. Indentation is significant, so a misplaced space changes the meaning of a file. Implicit typingโunquoted true becoming a boolean, unquoted 2026-05-05 becoming a date in older parsersโhas caused well-documented bugs like the “Norway problem,” where the country code NO parsed as false in YAML 1.1 implementations . YAML 1.2 addressed these issues by restricting implicit typing and removing sexagesimal numbers, but many parsers, particularly Python’s PyYAML, still implement YAML 1.1 semantics .
a. The YAML specification lineage
YAML has three specification versions. YAML 1.0 was published in 2004; 1.1 in 2005; and 1.2 in 2009. A clarifying revision, 1.2.2, was completed in October 2021 . The 1.2 specification made JSON a strict subset of YAML, meaning every valid JSON document is also valid YAML, and tightened implicit typing rules to eliminate the most common parsing surprises .
The specification gap matters in practice because the parser you use determines the YAML you get. A file that behaves one way in a Rust-based YAML 1.2 parser may behave differently in PyYAML, which implements 1.1 and has not changed its core semantics since 2006 . When a YAML file “doesn’t work,” the first question is often which specification version the parser implements.
b. Where YAML is used
YAML’s adoption is concentrated in infrastructure and configuration. Kubernetes manifests define every resourceโdeployments, services, config mapsโas a YAML document with a fixed apiVersion, kind, metadata, and spec structure . Docker Compose uses compose.yml to define services, networks, volumes, and port mappings . Ansible playbooks declare desired server state, variables, and roles in YAML . GitHub Actions and GitLab CI define pipelines as YAML workflows .
The common thread is that these tools need configuration that humans write and machines read. JSON would workโevery one of these tools has a JSON equivalentโbut the verbosity of braces and quotes makes large configuration files harder to scan and edit. YAML’s indentation-based structure maps visually onto the hierarchy of the configuration itself, which is why the tools adopted it .
Outside infrastructure, YAML appears in static site generators for front matter (titles, dates, tags, authors), in OpenAPI specifications for API definitions, and in content management systems for metadata . The pattern is consistent: wherever structured data needs to be written by hand and read by both people and programs, YAML is a candidate.
Complete Example Session
# ============================================
# PART 1: A SCALAR MAP (KEY-VALUE PAIRS)
# ============================================
name: my-application
version: 1.2.0
replicas: 3
# ============================================
# PART 2: A LIST
# ============================================
environments:
- development
- staging
- production
# ============================================
# PART 3: NESTED STRUCTURE
# ============================================
database:
host: db.example.com
port: 5432
credentials:
username: app_user
# password comes from an environment variable
password: ${DB_PASSWORD}
# ============================================
# PART 4: ANCHORS AND ALIASES (REUSE)
# ============================================
defaults: &default_settings
timeout: 30
retries: 3
service_a:
<<: *default_settings
endpoint: /a
service_b:
<<: *default_settings
endpoint: /b
# ============================================
# PART 5: THE PARSED RESULT (MENTAL MODEL)
# ============================================
# {
# name: "my-application",
# version: "1.2.0",
# replicas: 3,
# environments: ["development", "staging", "production"],
# database: { host: "db.example.com", port: 5432, credentials: { ... } },
# service_a: { timeout: 30, retries: 3, endpoint: "/a" },
# service_b: { timeout: 30, retries: 3, endpoint: "/b" }
# }
The parts covered scalars and maps, lists, nested structure, anchors and merge keys for reuse, and the parsed data model that the YAML represents.
Quick Reference
YAML Timeline
| Year | Event |
|---|---|
| 1999 | First “YML” mention by Clark Evans |
| 2001 | YAML first publicized (12 May); name coined |
| 2004 | YAML 1.0 specification |
| 2005 | YAML 1.1 specification |
| 2009 | YAML 1.2 specification |
| 2021 | YAML 1.2.2 clarifying revision |
Common YAML Tools
| Tool | File | Purpose |
|---|---|---|
| Kubernetes | deployment.yaml | Container orchestration |
| Docker Compose | compose.yml | Multi-container apps |
| Ansible | playbook.yml | Configuration management |
| GitHub Actions | .github/workflows/*.yml | CI/CD pipelines |
| OpenAPI | openapi.yaml | API specifications |
Core Data Types
| Type | YAML Example |
|---|---|
| String | name: my-app |
| Number | replicas: 3 |
| Boolean | enabled: true |
| List | - item1 (under a key) |
| Map | key: followed by indented pairs |
Best Practices
โ Do This:
# Quote strings that look like booleans or numbers
country_code: "NO" # โ
(not false)
version: "1.2" # โ
(not number)
# Use spaces, never tabs, for indentation
key:
nested: value # โ
# Use anchors for repeated blocks
defaults: &defaults
timeout: 30
service: { <<: *defaults } # โ
โ Don’t Do This:
# Unquoted ambiguous values
country_code: NO # โ (YAML 1.1: boolean false)
# Tabs for indentation
key:
nested: value # โ (parse error)
# Duplicate keys
name: app1
name: app2 # โ (last wins, silent)
Common Pitfalls
| Pitfall | Why It Happens | Fix |
|---|---|---|
NO parsed as false | YAML 1.1 implicit boolean | Quote as "NO" |
| Tab indentation error | Tabs forbidden for indentation | Use spaces only |
| Date parsed as string (1.2) | Timestamp removed from core schema | Parse explicitly if needed |
| Duplicate key silently overwritten | No duplicate-key warning | Lint the YAML |
Real-World Examples
1. Kubernetes deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: web
spec:
replicas: 3
2. Docker Compose service
services:
web:
image: nginx:latest
ports:
- "80:80"
3. Ansible task
- name: Install nginx
apt:
name: nginx
state: present
4. GitHub Actions workflow
on: push
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
5. Front matter for a static site
---
title: My Post
date: 2026-05-05
tags: [yaml, config]
---
6. Anchor for repeated config
logging: &log
level: info
format: json
api: { <<: *log }
worker: { <<: *log }
7. Quoting the Norway problem
country: "NO"
8. List of maps
users:
- name: Ana
role: admin
- name: Ben
role: viewer
9. Environment variable interpolation
password: ${DB_PASSWORD}
10. Multi-document file
---
kind: ConfigMap
---
kind: Secret
Visual
YAML Origins
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ YAML ORIGINS (2001) โ
โ โ
โ Clark Evans + Oren Ben-Kiki โ
โ (simplifying XML in sml-dev) โ
โ โ โ
โ โ Ingy dรถt Net โ
โ โ (Data::Denter for Perl) โ
โ โ โ โ
โ โโโโโโฌโโโโโ โ
โ โผ โ
โ YAML first publicized 12 May 2001 โ
โ Name: "Yet Another Markup Language" โ
โ โ โ
โ โผ โ
โ Renamed: "YAML Ain't Markup Language" โ
โ (emphasis on data, not documents) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Where YAML Sits
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ CONFIGURATION FORMAT LANDSCAPE โ
โ โ
โ Human-readable โโโโโโโโโโโโโโโโโโโโโโโโบ Machine-first โ
โ โ
โ YAML TOML JSON XML โ
โ โ โ โ โ โ
โ โผ โผ โผ โผ โ
โ Indentation Sections Braces Tags โ
โ significant + keys + quotes + nesting โ
โ โ
โ YAML: most readable, most implicit โ
โ JSON: most explicit, least readable โ
โ Both: Kubernetes, Docker, CI โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
The Configuration Tool Stack
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ TOOLS THAT USE YAML โ
โ โ
โ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โ
โ โ Kubernetes โ โ Docker โ โ Ansible โ โ
โ โ manifests โ โ Compose โ โ playbooks โ โ
โ โโโโโโโโฌโโโโโโโโ โโโโโโโโฌโโโโโโโโ โโโโโโโโฌโโโโโโโโ โ
โ โ โ โ โ
โ โโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโ โ
โ โผ โ
โ โโโโโโโโโโโโโโโโ โ
โ โ YAML โ โ
โ โ (shared โ โ
โ โ format) โ โ
โ โโโโโโโโโโโโโโโโ โ
โ โ โ
โ โโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโ โ
โ โผ โผ โผ โ
โ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โ
โ โ GitHub โ โ GitLab CI โ โ OpenAPI โ โ
โ โ Actions โ โ pipelines โ โ specs โ โ
โ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Summary
| Item | Value |
|---|---|
| Full name | YAML Ain’t Markup Language (recursive) |
| Original name | Yet Another Markup Language |
| First publicized | 12 May 2001 |
| Creators | Clark Evans, Ingy dรถt Net, Oren Ben-Kiki |
| Type | Data serialization language |
| Specification versions | 1.0 (2004), 1.1 (2005), 1.2 (2009) |
| Key design choice | Indentation-based nesting |
| Primary use | Configuration files, infrastructure as code |
| Defining tools | Kubernetes, Docker Compose, Ansible, CI/CD |
Key takeaways:
- YAML is a data serialization language, not a markup language. The name change from “Yet Another Markup Language” to “YAML Ain’t Markup Language” reflects the shift in emphasis from documents to data .
- It emerged from XML frustration and Perl serialization needs. Clark Evans and Oren Ben-Kiki wanted a simpler alternative to XML; Ingy dรถt Net had built Data::Denter. The three collaborated within days of the first draft .
- Indentation is the syntax. Nesting is expressed by spaces, not braces. This is what makes YAML readable and what makes a misplaced space a parse error.
- The specification and the parser are different things. YAML 1.2 fixed the implicit-typing problems of 1.1, but PyYAML still implements 1.1, which is why the “Norway problem” persists in Python ecosystems .
- Infrastructure tools adopted YAML for readability. Kubernetes, Docker Compose, Ansible, and CI/CD pipelines all use YAML because humans write the configuration and machines read it. JSON would work; YAML is easier to scan and edit .
Remember: YAML exists because structured data needs to be readable by the people who write it, not just the programs that consume it. That design goal produced indentation-based syntax, minimal punctuation, and a set of implicit typing rules that have caused real bugs. Understanding YAML means understanding both the readability it offers and the precision it requires: quote ambiguous values, use spaces for indentation, and know which specification version your parser implements. The format is small; the failures come from the edges.
Stop using slow, ad-bloated tool sites! ๐คฎ
๐ Search “KandZ Tools” on Google to use many professional utilities for free.
KandZ.me is the ultimate minimalist hub for:
โ
Finance (Mortgage, Interest, Inflation)
โ
Tech (Base64, JSON, Dev Suite, IP)
โ
Health (BMI, BMR, TDEE)
โ
Productivity (Timer, Workspace, QR)
โก๏ธ Fast & Private
๐ No data leaves your device
๐ 100% Free
๐ Use it now: https://tools.kandz.me
๐ Bookmark itโyouโll need it later!