TOML Cheatsheet - TOML Configuration Reference
Tools like Cargo, Hugo and Greenlet configure with TOML, whose explicit [table] blocks and key = value syntax make it more readable than JSON and support comments. This reference groups 6 sections: basic types, date-time, four string flavors, arrays and tables, arrays of tables, plus a ready-to-adapt Cargo.toml example. Mirror the structure while writing a dependency table or nested section, and look up string escaping or date-time offsets as needed to avoid common type and indentation ambiguity. After reading you can maintain Cargo.toml and similar TOML config on your own.
Basic Types 11
# this is a commentkey = "value"key = 'value'int = 42hex = 0xFFoct = 0o17bin = 0b101num = 1_000_000float = 3.14flt = infbool = trueDate & Time 5
date = 2026-07-19time = 14:30:00datetime = 2026-07-19T14:30:00datetime = 2026-07-19T14:30:00Zdatetime = 2026-07-19T14:30:00+08:00Strings 4
str = "Hello\nWorld"str = """Hello\nWorld"""str = 'C:\\path\\to\'str = '''C:\\path\\to\'''Arrays & Tables 6
array = [1, 2, 3]array = [\n 1,\n 2,\n 3,\n][table][table.subtable]physical.color = "orange"inline = { key1 = "value1", key2 = 2 }Array of Tables 4
[[products]]name = "Apple"[[products]]name = "Banana"Cargo.toml Example 8
[package]name = "myapp"version = "0.1.0"edition = "2021"[dependencies]serde = "1.0"serde = { version = "1.0", features = ["derive"] }[dev-dependencies]Tips
- TOML prioritizes readability and fits config files better than JSON.
- Strings come in basic (double-quoted, escapes) and literal (single-quoted, no escapes).
- Tables [table] and arrays of tables [[array]] are TOML's core structures.
Official References
Each command links to its official documentation below, so you can verify the latest usage and read deeper.
Maintained by LaoHand
Publicly updated on Jul 21, 2026, continuously proofread against official docs.
Contact Us
Wrong command or description? Send us corrections, business inquiries or product feedback by email.
Contact Us