TOML to JSON Converter

Parse TOML, report syntax errors with their position, and output the equivalent JSON.

Loading tool…

About the TOML to JSON

TOML is the configuration format of Cargo.toml, pyproject.toml, Hugo and many other tools. The document is parsed with smol-toml, a parser for TOML 1.0. A table [server] becomes a JSON object, dotted keys such as a.b = 1 become nested objects, an array of tables [[workers]] becomes an array of objects, and an inline table { min = 2, max = 20 } an object. Comments are dropped because JSON cannot hold them.

JSON has no date type, so the four kinds of TOML dates are written as strings in RFC 3339 form: an offset date-time stays as written ("1979-05-27T00:32:00-07:00"), a local date-time has no offset ("1979-05-27T07:32:00"), a local date is "1979-05-27" and a local time "07:32:00". Fractions of a second are kept to the millisecond. Integers beyond 253 are written in full, although JavaScript rounds them when it reads the JSON, and inf and nan, which JSON does not have, are written as the strings "inf", "-inf" and "nan".

Invalid TOML gives an error with the line and column, for example a key that is defined twice, a table that is declared again, a string that is not closed or a number with a leading zero. That makes the tool a quick validator before you commit a configuration file. TOML keeps tables after the plain values of their parent, so the order of keys in the JSON follows the TOML document. The conversion runs in your browser.

How to use it

  1. Paste TOML or open a .toml file.
  2. Fix any error reported with its line and column.
  3. Choose the indentation and copy or download the JSON.
  4. Use Swap to convert the result back to TOML.

Frequently asked questions

How are TOML dates converted?
To strings in RFC 3339 form. An offset date-time keeps its offset, a local date-time, date or time is written without one: "2026-09-28T17:42:09Z", "2026-09-28T17:42:09", "2026-09-28", "17:42:09".
What is the difference between [table] and [[table]]?
[table] defines one table, a JSON object. [[table]] adds one item to an array of tables, so writing it three times gives a JSON array with three objects.
Why is a key reported as defined twice?
TOML does not allow a key or a table to be defined more than once. This also happens when a dotted key such as a.b = 1 and a table [a.b] describe the same place.

Related tools