YAML Data Structures
Scalar (Single Value)
name: "Evan"
count: 42
active: true
Array/List (Ordered Values)
Block style:
tags:
- security
- linux
- networking
Inline style:
tags: [security, linux, networking]
Multi-line inline (for long arrays):
backup-codes: [
11111, 22222, 33333, 44444, 55555,
66666, 77777, 88888, 99999, 00000
]
Object/Map (Key-Value Pairs)
Block style:
server:
ip: 10.50.1.20
port: 443
Inline style:
server: {ip: 10.50.1.20, port: 443}
Nested Structures
Array of objects:
users:
- name: "Evan"
role: "admin"
- name: "Guest"
role: "readonly"
Object with arrays:
account:
username: "evan"
emails: [primary@mail.com, backup@mail.com]
backup-codes: [
11111, 22222, 33333, 44444, 55555,
66666, 77777, 88888, 99999, 00000
]
Quick Reference
| Symbol | Meaning | Example |
|---|---|---|
|
Array/list of values |
|
|
Object with key-value pairs |
|
|
Block-style list item |
|
|
Property name |
|
|
Literal block (preserves newlines) |
|
|
Folded block (joins lines) |
|
Style Preferences
For gopass metadata files:
description: "Service name"
url: "https://example.com"
tags: [tag1, tag2, tag3]
usernames: []
emails: []
backup-codes: [
11111, 22222, 33333, 44444, 55555,
66666, 77777, 88888, 99999, 00000
]
-
Quoted strings for vim
ci"editing -
Inline arrays
[]for compactness -
Multi-line arrays for readability (5 per row)
-
Empty arrays
[]for placeholders -
No trailing commas before
]