What the converter does
This JSON to TOML converter turns a JSON object into a TOML 1.0 document as you type, entirely in
your browser. Nested objects become [section] tables, lists of objects become arrays of tables,
everything else sits on the line of its key, and keys are quoted only when TOML requires it. It is
the quickest way to convert JSON to TOML when a tool such as Cargo, Poetry, pyproject.toml, Hugo or
a Netlify config wants TOML and the data you have is JSON.
The output is meant to be read and edited by a person afterwards, which is the reason to use TOML at all: short lines, one value per line, sections you can scan. TOML is also the less forgiving of the two popular config formats in one useful way: there is no indentation to get wrong, and a value's type never depends on whether it happens to look like a number or a boolean. What you see after the equals sign is exactly what the program reads.
TOML syntax in one screen
A TOML file is a table of key = value pairs. Strings are always quoted, numbers and true and
false are not. A header such as [database] starts a new table, and [database.connection] a table
inside it — the parent does not need its own header, so an object that only holds other objects
never gets one here.
Keys made of letters, digits, - and _ are written bare. Anything else, including a dot, a space
or an accented letter, is wrapped in double quotes, both in the pair and in the header, because an
unquoted dot would mean nesting. Inline tables, { x = 1, y = 2 }, are used where a header is not
possible: inside a list that also holds numbers or strings.
Multi-line text is written as a """ block when it is the value of a key, so a script or a
certificate stays readable. Inside inline lists and tables it is escaped with \n instead, because
inline tables must fit on one line.
TOML array of tables
A JSON list whose items are all objects becomes an array of tables: each item gets its own
[[servers]] header followed by its keys. Nested lists of objects repeat the pattern with a longer
name, [[servers.disks]], which belongs to the [[servers]] above it. A list that mixes objects with
other values cannot use that form, so it is written inline instead.
What does not translate
null has no TOML equivalent at all, and the converter stops with the path of the first one
instead of dropping the key without telling you. Dates stay strings: JSON cannot tell a date from
text, so nothing is converted by guesswork, and the tool reports how many values look like dates.
Large numbers lose precision before they reach this page, because JSON.parse stores every
number as a 64-bit float; IDs longer than 15 digits belong in strings. And a JSON 1.0 arrives as
1, so it is written as an integer.
To go from JSON to the other popular config format, use the JSON to YAML converter. To tidy or validate the JSON first, there is the JSON formatter.