YAML is a format of data representation in the most human-readable form. It is very close to markup languages.
At the beginning YAML was created as a competitor to XML. Its abbreviation meant Yet Another Markup Language. Now it is interpreted as “YAML Ain’t a Markup Language”.
It has a lot of benefits:
- more human-readable and lighter comparing to XML and JSON;
- support data structures of basic programming languages;
- can be transferred between different programming languages;
- expressive and extensible;
- easy to use.
YAML-files has .yaml extension. They are case-sensitive and does not support tabs (spaces are used instead). YAML has standard set of data types: scalars, lists and dictionaries.
Scalars are just key-value pairs divided by semicolon. Values could be numeric or strings. For complex strings that contain dashes or colons you’ll need to quote your data with single or double quote.
name: “James Smith-Edison” age: 27 married: Yes
Lists in YAML
Lists simply represent sequences of values. Each value in list starts with dash.
- red - green - blue
You can add sub-sequences to your list with adding an advanced space to each level before the dash.
- - - Michael Jordan - LeBron James
This data structure is well-known for software developers. It contains a sequence of key-value pairs.
stuff: mp3: iPod Nano phone: Google Nexus 5 headphones: Monster Beats