-
Notifications
You must be signed in to change notification settings - Fork 0
YAML
Manoj Kumar edited this page Feb 2, 2025
·
2 revisions
- Ain't Markup Language
- A strict superset of JSON
- A human-friendly data serialization language for all programming languages.
- A YAML file relies on whitespace and indentation to indicate nesting.
- The number of spaces used for indentation doesn’t matter as long as they are consistent.
- Tab characters cannot be used for indentation in YAML files; only spaces can be used.
A YAML format primarily uses three node types:
- Maps/Dictionaries (YAML calls it mapping)
- The content of a mapping node is an unordered set of key/value node pairs, with the restriction that each of the keys is unique. YAML places no further restrictions on the nodes.
- Maps in YAML files can be nested by increasing the indentation, or new maps can be created at the same level by resolving the previous one.
- Arrays/Lists (YAML calls them sequences)
- The content of a sequence node is an ordered series of zero or more nodes. In particular, a sequence may contain the same node more than once. It could even contain itself.
- Sequences in YAML are represented by using the hyphen (-) and space.
- Can be embedded inside a map using indentation.
- Literals (Strings, numbers, boolean, etc.)
- The content of a scalar node is an opaque datum that can be presented as a series of zero or more Unicode characters.








The YAML specification supports a number of features that you should probably never use, things that will not universally work across all parsers, will make your YAML non-portable to JSON, and will likely confuse people unfamiliar with these functions:
- Anchors
- References
- Extensions

Using new YAML data types will not necessarily directly transfer to JSON parsers, including:
- date/datetime
- set
- !!binary