The failure mode nobody reads until 2 a.m.
Indentation is the silent killer. A pipeline log shows a vague parse error while your file looks fine in the editor because invisible whitespace changed. This page exists so you rehearse structure before you merge.
YAML trades braces for whitespace. You read fewer symbols, yet one sloppy paste from a chat window still misaligns a tree.
What the playground checks (and skips)
The checker spots tabs, uneven spacing, and quotes left open. The playground never runs your file against a live schema, so a Kubernetes manifest still needs kubectl or a cluster dry run before you call production safe.
For a deeper tidy pass after you fix syntax, pair this page with the YAML beautifier when you want consistent wrapping across a large file.
YAML beside JSON on the same team
| Topic | YAML | JSON |
|---|---|---|
| Comments | Yes, with # | No |
| Trailing commas | Not allowed | Not allowed |
| Readable configs | Strong fit | Noisy for humans |
When you bounce between formats, keep the JSON cheat sheet nearby so you do not mix rules.
Where YAML shows up in shipping software
- GitHub Actions and GitLab CI workflows
- Docker Compose stacks on a laptop
- Kubernetes objects before kubectl apply
- Ansible inventories when you automate hosts
Each tool adds extra keys. The grammar on this page is the shared floor. The schema is the ceiling.
Block scalars when a single line is not enough
Long certificates, SQL, and markdown blocks belong in literal or folded scalars. A pipe keeps newline characters so your shell script keeps every line break. A greater-than folds soft breaks into spaces, which helps prose but surprises people who expected hard wraps.
Indent the content one level deeper than the key, or parsers treat the next line as a sibling node. If you copy from a wiki, re-indent before you validate.
Anchors, aliases, and merge keys
YAML lets you stamp an anchor on a mapping, reuse an alias elsewhere, and merge defaults with a merge key. Power users love the brevity. Reviewers hate hunting hidden inheritance during an outage.
We do not highlight anchors in the playground tiles above because many CI templates forbid them outright. If your org allows them, keep depth shallow and name anchors like you name functions.
When the parser disagrees with your editor theme
Most pain arrives from mixing YAML 1.1 and 1.2 rules around booleans and sexagesimal numbers. A bare yes or no might parse as boolean in one runtime and as a string in another. Quoting removes the ambiguity at the cost of noise.
Version pins matter for Ruby, Python, and Go loaders. Pin the parser in your service the same way you pin dependencies, then lint configs in CI so drift shows up as a failed build instead of a silent cast.
Stop shipping secrets in plain YAML
Files are easy to grep. Store tokens in a vault or secret manager, reference them with environment injection, and keep samples redacted. The playground never stores your paste, yet a committed file lasts forever in git history.
Workflow tip from teams who review a lot of diffs
Load the sample, break a dash on purpose, validate, then undo. You build muscle memory for how errors read. When you edit long term in Vim, the Vim cheat sheet still saves time on bulk indent shifts.
Red flags worth a second glance
Duplicate keys in one mapping should fail fast, yet some loaders pick the last winner quietly. Environment-specific files often repeat keys by accident after a bad merge. Run a structural diff, not only a text diff, before you promote a branch.
Large files become slow in browser tools. Split responsibilities across files when your platform supports includes, or trim unused keys so reviewers see signal. The playground handles everyday snippets. Multi-megabyte dumps belong in offline linters.
Unicode looks innocent until invisible direction marks sneak in from a PDF. Re-type critical keys if you suspect copy damage, or normalize through an editor command before you validate.
Need front-end context next? Scan the JavaScript cheat sheet for parsing patterns, or the CSS selector cheat sheet when your YAML drives a static site generator.
