A tour of TOML v1.0.0 syntax
TOML (Tom’s Obvious, Minimal Language) is a configuration format designed to be
easy to read and to map cleanly onto a hash table. It powers Cargo.toml,
pyproject.toml and many other tool configs. This reference covers keys and
tables, every string variant, number formats, arrays and the four date-time
types.
How it works
A TOML file is a set of key/value pairs grouped into tables. A header in square brackets opens a table; dotted names create nesting; double brackets build an array of tables:
title = "Example"
[server]
host = "127.0.0.1"
ports = [80, 443]
tls = { enabled = true, min = "1.2" }
[[products]]
name = "A"
[[products]]
name = "B"
created = 1979-05-27T07:32:00Z
Every value has a clear type: integers (with _ separators and 0x/0o/0b
prefixes), floats, booleans (true/false only), strings in four flavours,
arrays, and the RFC 3339 temporal types. Files must be valid UTF-8.
Tips and notes
- Use literal strings (single quotes) for Windows paths and regex to avoid escaping.
[[name]]appends to an array of tables; plain[name]defines a single table.- Booleans are lowercase only; there is no
Trueoryes. - Defining the same key twice is an error — that strictness prevents silent overrides.