YAML Ain’t Markup Language (YAML)
YAML
addresses the same domain as JSON. One can describe the same objects as one could with JSON. YAML
is easier to read by humans, though, and YAML
supports comments, which JSON does not.
A downside of YAML
could be that its meaning depends on the indentation of each individual line. This could make YAML
files somewhat hard to read and maintain if there are many levels.
Some rules, to get an idea:
YAML
files should start with---
.a: b
indicates a field “a” with the value “b”.- item 1
indicates an item of an Array.a:
is the beginning of a Dictionary or Array. On the next line increase the indentation, and either declare a field or an item.- Anything after a
#
is a comment. - Values usually don’t have to be quoted. It is only necessary if it contains special characters like a
:
. - The data type of a value is determined by its content (but could be set explicitly, which rarely happens). I.e. “John” is a string, “true” and “yes” are booleans, “3.5” is a floating point, etc.
YAML
supports multi-line strings.YAML
supports IDs and References.
yaml