YAML — YAML Ain't Markup Language

Reference & Beautifier

# Strings — bare or quoted
name:        Ada Lovelace
title:       "Countess of Computing"
bio: |
  First programmer.
  Wrote the algorithm.

# Numbers, booleans, null
age:         36
pi:          3.14159
active:      true
nickname:    null

# Sequence (list)
scores:
  - 98
  - 100
  - 87

# Nested mapping (object)
address:
  city:      London
  postcode:  W1A 1AA

# Anchors & aliases
defaults: &defaults
  timeout: 30
production:
  <<: *defaults
  timeout: 60
key: — mapping key string — text value 42 — number true/false — boolean null — nothing &anchor *alias — reuse # comment — ignored
string
bare · "quoted" · 'single'
Bare words are strings. Quote when special chars needed.
number
42 · -7 · 3.14 · 1e6
Integer or float. Written without quotes.
boolean
true · false · yes · no
true/false (also yes/no, on/off in YAML 1.1).
null
null · ~ · (empty)
Explicit absence of value. Tilde ~ is shorthand.
mapping
key: value
Key–value pairs. Keys end with a colon and space.
sequence
- item1 - item2
Ordered list. Each item prefixed with "- ".
block scalar
key: | line one line two
| preserves newlines. > folds them into spaces.
anchor/alias
&name · *name · <<:
Define once with &, reuse with *. Merge maps with <<:.