TOML's biggest advantage over JSON: real dates
Numbers
- Integer — 64-bit signed.
42,-17,1_000_000(digit grouping with underscores). Hex/octal/binary literals:0xff,0o755,0b1010. - Float — IEEE 754 double.
3.14,1e6,1.5e-3. Special values:inf,-inf,nan(literal — JSON doesn't allow these).
Booleans
Lowercase only: true or false. Not True, not TRUE, not yes. The Norway problem can't happen here — there's exactly one way to write each.
Dates and times — the killer feature
- Offset Date-Time — RFC 3339 with timezone.
1979-05-27T07:32:00-08:00. The most precise form. - Local Date-Time — no timezone.
1979-05-27T07:32:00. - Local Date —
1979-05-27. - Local Time —
07:32:00.
Native dates parse directly into datetime objects (Python), chrono::DateTime (Rust), time.Time (Go). No 'parse this string as ISO 8601' code in your config loader.
Principle: when your data has dates, prefer TOML over JSON. JSON forces 'string by convention' + a parser pass; TOML gives you a typed value out of the box. The downstream code is shorter, the bugs are fewer.