YAML (recursively “YAML Ain’t Markup Language”, originally “Yet Another Markup Language”) is a human-readable data description language used above all for configuration files and data structuring. YAML uses a simple, indentation-based syntax to represent complex data in an easily readable and writable form and is frequently used for configuration files, APIs and data transfer.
YAML syntax at a glance
name: aceArt GmbH
founded: 2015
services:
- Web development
- App development
- SEO
contact:
city: Stuttgart
active: true
Structure arises exclusively through indentation with spaces – tabs are not allowed per the specification, since they’re rendered at different widths depending on the editor and would make the structure ambiguous. Lists are represented with a hyphen, nested objects through additional indentation levels.
YAML vs. JSON
Both formats represent the same data structures but differ clearly in their aims:
| YAML | JSON | |
|---|---|---|
| Readability for humans | High, through indentation instead of brackets | Lower, compact and bracket-heavy |
| Comments | Supported (# comment) | Not supported |
| Structure errors | Harder to spot (invisible indentation errors) | Easier to spot (a missing bracket is visible) |
| Typical use | Configuration files | APIs, data exchange between systems |
Since JSON is a subset of YAML, every valid JSON document is automatically valid YAML too.
Common pitfalls
- Tabs instead of spaces: leads to parser errors, since YAML permits only spaces for indentation.
- Unquoted ambiguous values: words like
yes,no,onoroffare automatically interpreted as booleans by some YAML parsers – problematic with country codes likeNO, say. When in doubt, always quote. - Inconsistent indentation depth: unlike curly braces in JSON, a single wrong space in YAML silently changes the document structure without producing an obvious error.
A solid understanding of the underlying syntax helps catch such errors early instead of only noticing them at execution time.
YAML in CI/CD and container infrastructure
YAML is today practically the standard for configuration files in modern development workflows: CI/CD pipelines define build and deployment steps in YAML, Docker Compose files describe container setups, and Kubernetes uses YAML as the primary format for practically every resource definition. Its good human readability makes YAML particularly suited to files regularly maintained by hand and read in code review.
Conclusion
YAML has established itself as the standard for readable, maintainable configuration files, from simple application settings to complex CI/CD and Kubernetes infrastructures. We’re happy to support you with setting up and maintaining the corresponding deployment and infrastructure configuration as part of our custom software development or directly in a no-obligation consultation.
Häufige Fragen
Is YAML the same as JSON?
Why can't you use tabs for indentation in YAML?
Why are some values in YAML interpreted unexpectedly, e.g. "no" as false?
yes, no, on or off as boolean values instead of text – a notorious problem that in practice leads to errors with country codes like NO (Norway), say. To avoid this, such ambiguous values should always be explicitly quoted.What is YAML most frequently used for in practice?
Can you mix YAML and JSON?
{ } and [ ] can be used directly in YAML documents. In practice this is rarely done, but it’s technically unproblematic and sometimes practical for compact, single-line lists.