YAML Cheat Sheet

Master YAML with our comprehensive cheat sheet. Explore essential syntax and best practices for configuration and data serialization. Perfect for developers.


# This is a comment
Scalar Types
string: "Hello, World"integer: 123float: 3.14boolean: true
base: &default adapter: postgres host: localhostdevelopment: <<: *default database: dev_db
name: &name Exampleperson: name: *name
Multiline strings
key: | This is a multiline string.
Folded strings
key: > This is a folded string.
Two Documents
---key: value---another_key: another_value

YAML Collections

set: ? item1 ? item2 ? item3
Ordered Mappings
ordered_map: key1: value1 key2: value2
Mapping to Sequences
mapping_to_sequences: key1: - item1 - item2 key2: - item3 - item4
Sequence of Mappings
sequence_of_mappings: - key1: value1 key2: value2 - key3: value3 key4: value4
mapping: key1: value1 key2: value2
Mapping of Mappings
mapping_of_mappings: parent1: child1: value1 child2: value2 parent2: child3: value3 child4: value4

Shortcut Keys