Tom's Obvious Minimal Language (TOML) Reference
Kip Landergren
(Updated: )
Contents#
Example#
TOML:
title = "Foo App"
version = "2.3.8"
debug = false
[owner]
name = "Kip Landergren"
joined = 2026-10-12
[database]
host = "localhost"
ports = [5432, 5433]
max_connections = 50
[[servers]]
name = "alpha"
ip = "10.0.0.1"
[[servers]]
name = "beta"
ip = "10.0.0.2"
[[servers.metadata]]
os = "ubuntu"
[[servers.metadata]]
product_code = "AB"
[[servers]]
name = "gamma"
ip = "10.0.0.3"
And the JSON equivalent:
{
"title": "Foo App",
"version": "2.3.8",
"debug": false,
"owner": {
"name": "Kip Landergren",
"joined": "2026-10-12"
},
"database": {
"host": "localhost",
"ports": [5432, 5433],
"max_connections": 50
},
"servers": [
{
"name": "alpha",
"ip": "10.0.0.1"
},
{
"name": "beta",
"ip": "10.0.0.2",
"metadata": [
{
"os": "ubuntu"
},
{
"product_code": "AB"
}
]
},
{
"name": "gamma",
"ip": "10.0.0.3"
}
]
}
Tips#
Binary Data and Strings#
Don’t store binary data directly in string values—encode it using a binary-to-text algorithm (like hexadecimal sequences or Base64) first.
Strings in TOML are sequences of Unicode characters and writing binary data directly risks corruption during deserialization.
When Working With Go#
Consider capitalizing public field names: doing so in your .toml file obviates the need for struct tags for simple serialization / deserialization.
Prefer:
Foo = "bar"
Over:
foo = "bar"
Resources#
- Specifications
- Official Website
- List of library implementations
Terminology#
- header#(term header)
- 1.
The square-bracketed text that defines the start of a table:
[header] foo = "bar" - root table#(term root table)(term top level table)
- 1.
The highest level table of the TOML document.
Also: top level table
Related:
- table#(term table)(term hash table)
- 1.
A collection of key value pairs.
Also: hash table
Related: