Comments start with: # and extend to the end of the Line
'Text Strings': can be enclosed in 'single' or "double" Quotes.
Yaml has these Structures:
- Sequences are simply ordered Lists of Yaml Structures (recursive!)
- In Block Mode, each Item is on a single Line prefixed by a Dash '-' like this Line
- In Flow Mode, several Items are placed in angular Brackets, separated by Commas or Tabs:
[Apples, Pears, Bananas, etc.]
Mapping:
- Mappings are a Set of unique Keys, each mapped to a single Yaml Structure (recursive!)
- Keys can also be Yaml Structures (recursive!), but must be prefixed with a Question Mark '?' if longer than 1000 Characters
- In Block Mode, each Pair is on a single Line with the Key separated by a Colon ':' from the Value
- In Flow Mode, several Items are placed in angular Brackets, separated by Commas:
{Apples: Fruit, Spinach: Veggie, Salmon: Fish }
- &Anchor Anchors mark a Yaml Structure and must be unique within a Document
- References avoid repeating the above Data like here:
*Anchor
Text can be written in different Notations:
- In Block Mode, each Pair is on a single Line with the Key separated by a Colon ':' from the Value
- In Flow Mode, several Items are placed in angular Brackets, separated by Commas:
- Double-Quoted Text can employ C-like Escape Sequences using Backslash '\': \r, \n, \t, \f, \v, \0, \\
- Single-Quoted Text can contain any Character; single Quotes must be doubled though
Numbers:
Numbers are supported in different Notations:
decimal: 3.1415926
hex: [0x00, ..., 0xfff, ..., 0xAffe]
octal: 0o777
.inf: Infinity; also -.inf for negative Infinity
.nan: Not a Number, results from e.g. 0/0, .inf / .inf or 0 * .inf
null: is an empty Object
Boolean:
- true
- false
Number: 3.1415
Spaces or Tabs can be used to indent and nest Structures