- The top level must be an object
- A TOML document is a table, so it cannot start with an array or a bare scalar. Converting [1,2] therefore fails with a clear error rather than inventing a wrapper key, wrap it yourself as {"items":[1,2]} so the resulting key name is your choice.
- Nested objects become table headers
- An object at {"database":{"server":"localhost"}} is written as a [database] header followed by its keys, and a deeper object produces [database.settings]. Order matters in the output: every plain key must appear before the first table header at its level, because a key after a header belongs to that table. The serialiser handles this ordering for you.
- null has no representation, so those keys are dropped
- TOML deliberately has no null type, the position is that an absent key is how you express "no value". Any key whose value is null is therefore omitted from the output entirely, and a warning tells you which. If null is meaningful in your data, replace it with a sentinel such as an empty string or false before converting.
- Arrays of objects become array-of-tables
- A JSON array whose entries are objects is written with the double-bracket [[name]] syntax, one block per entry. Arrays of scalars stay inline as [1, 2, 3]. TOML also requires that array elements be of a single type, so a mixed array such as [1, "a"] cannot be represented in older TOML versions.
- Dates are strings on the way in
- TOML has first-class date and time types, but JSON does not, so an ISO 8601 string in your JSON stays a quoted string rather than becoming a TOML datetime. Converting the other way does produce real dates, which is why a JSON to TOML to JSON round trip can change a value from a string into a date.