YAML (YAML Ain't Markup Language)
Introduction
According to Wikipedia:
YAML (/ˈjæməl/) is a human-readable data-serialization language. It is commonly used for configuration files and in applications where data is being stored or transmitted. YAML targets many of the same communications applications as Extensible Markup Language (XML) but has a minimal syntax which intentionally differs from Standard Generalized Markup Language (SGML). It uses both Python-style indentation to indicate nesting, and a more compact format that uses
[...]
and{...}
for maps thus JSON file are valid YAML files.
Basics
- Custom datatypes are suppoerted, but YAML natively encodes:
- scalars (strings, numbers, booleans, null)
- lists (arrays)
- associative arrays (maps, hashes, dictionaries)
- YAML is a superset of JSON (JSON is a subset of YAML)
- Whitespace indentation is used for denoting structure
- Tab characters are not allowed as indentation
- Comments begin with the
#
character - List members are shown as
-
followed by a space, the value and separated by newlines - An associative array entry is represented using colon space in the form
key: value
- Strings are usually unquoted, but can be quoted using single or double quotes to avoid datatype ambiguity
- Block scalaras are delimited with indentation with optional modifiers to...
- Preserve
|
or... - Fold
>
the whitespace/newlines.
- Preserve