| | |

YAML 14 ๐Ÿ“„ Cheatsheet

โฑ๏ธ Estimated read: 2 min | |

Syntax Quick Reference

ElementSyntaxExample
Mappingkey: valuename: app
Sequence- item- apple
Nested mapIndentationserver:\n host: localhost
Flow mapping{k: v}point: {x: 1, y: 2}
Flow sequence[a, b]tags: [a, b]
Comment# text# http port
Document start------
Document end......

Scalar Styles

StyleSyntaxTyped
PlainvalueYes (schema)
Single-quoted'value'No (always string)
Double-quoted"value"No (escapes)
Literal|No (newlines kept)
Folded>No (newlines folded)

Chomping Indicators

IndicatorTrailing Newline
| (clip)One kept
|- (strip)None
|+ (keep)All kept

Anchors, Aliases, Merge

SymbolPurposeExample
&nameAnchor (define)defaults: &d
*nameAlias (reference)service: *d
<<Merge key<<: *d

Standard Tags

TagType
!!strString
!!intInteger
!!floatFloat
!!boolBoolean
!!nullNull
!!timestampTimestamp
!!binaryBase64 bytes

Schema Resolution

Schemayes0x1A2026-05-05
Failsafestringstringstring
JSONstringstringstring
Core (1.2)stringintstring
Extended (1.1)boolinttimestamp

Version Differences

FeatureYAML 1.1YAML 1.2
Booleansyes/no/on/offtrue/false only
Base-60YesRemoved
Octal07770o777
JSON subsetNoYes

Common Operations (Python)

OperationCode
Parseyaml.safe_load(f)
Parse multi-doclist(yaml.safe_load_all(f))
Writeyaml.dump(data, f, sort_keys=False)
Register tagyaml.add_constructor(tag, fn, Loader=yaml.SafeLoader)

Security Rules

RuleDetail
Never yaml.loadUse yaml.safe_load
Alias bombsBound expansion, size cap
Quoted hash# in quotes is literal
Register on SafeLoaderPass Loader=yaml.SafeLoader

Common Traps

TrapFix
NO โ†’ false (1.1)Quote as "NO"
1.10 โ†’ 1.1Quote as "1.10"
Unquoted URL colonurl: "postgres://..."
Tab indentationUse spaces only
Field array index keyUse field.id

Block Scalar Behavior

Input| Output> Output
line one\nline two"line one\nline two\n""line one line two\n"

Was this helpful?


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!