YAML Syntax

I’ll use this post to summarize some YAML syntax:

1. The dash in a sequence counts as indentation, so you can add a sequence inside of a mapping without needing spaces as indentation.

1: 
- 2: 3
  4: 5
- 6: 7
  8: 9
- 10
=> {1 => [{2 => 3, 4 => 5}, {6 => 7, 8 => 9}, 10]}

Basically, dashes delimit objects, and indentation denotes the “value” of the key-value pair.

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a comment