opyeb YAMLJSON

TOML syntax reference — tables, arrays, dates

2026-11-29 · 2 min read

TOML is a configuration format built for human readers. Structure comes from [table] headers instead of indentation, and every value has a clear type.

Tables and arrays of tables

[table] opens a table for the keys below it. [[array]] stacks tables with the same shape.

Defining the same table twice is an error. To open a child table, join the parts with dots as in [a.b].

[server]
host = "0.0.0.0"
port = 8080

[server.tls]
enabled = true

[[route]]
path = "/"
weight = 1

[[route]]
path = "/api"
weight = 2

Three kinds of string

A basic string ("...") processes escapes, a literal string ('...') keeps every character as typed. Paths and regular expressions are easier as literals.

Multi-line strings use triple quotes. The first newline is trimmed, so the body starts on the next line.

FormExampleBehaviour
basic"a\nb"escapes processed
literal'C:\temp'backslashes kept
multi-line"""..."""first newline trimmed
multi-line literal'''...'''no escapes

Numbers and dates

Integers accept 0x, 0o and 0b prefixes and underscores (1_000). A float needs a decimal point or an exponent, so write 5.0, not 5.

Dates and times are unquoted. 2026-01-15 is a date, 07:32:00 is a time, and joined with T they form an offset date-time.

Questions

Can a table be extended later?

Writing [a.b] first and [a] afterwards is allowed. Defining the same key twice is not.

Can an array mix types?

TOML 1.0 allows it, but some readers reject it. Config files are safer with one type per array.

Sources

Every example here can be pasted into the converter as it is.

Open the converter