tigtools

JSON to TOML Converter

Paste a JSON object and get TOML with tables and arrays of tables. Values TOML cannot represent are flagged instead of silently changed.

Runs in your browser No sign-up

Convert TOML to JSON instead

How to use it

  1. Paste a JSON object, or try the example.
  2. Turn on Leave out null values if your JSON contains nulls you do not need.
  3. Copy the TOML or download it as a .toml file.

How it works

The JSON is parsed strictly, then written as TOML 1.0 with the open-source smol-toml library. Nested objects become [tables], arrays of objects become [[arrays of tables]], and keys that are not plain words are quoted.

TOML cannot express everything JSON can. The document root must be a table, so a JSON array or a single value is rejected. There is no null in TOML: by default the first null is reported with its path; you can choose to leave out null object members instead. A null inside an array is always an error, because removing it would change the positions of the other elements. Arrays that mix types (for example numbers and strings) are valid in TOML 1.0 but not in the older 0.5 version, so they are counted in a note.

JSON does not distinguish 1 from 1.0, so whole numbers are written as TOML integers. Strings that look like dates stay strings. The other direction is TOML to JSON.

Examples

App settings

{"server": {"host": "0.0.0.0", "port": 8080}} becomes a [server] table with host and port keys.

List of workers

"workers": [{"queue": "mail"}, {"queue": "images"}] becomes two [[workers]] blocks.

Frequently asked questions

Why is null not allowed?

TOML has no null value. Leave the key out or use a value such as an empty string, depending on what the reading program expects.

Why does an array of numbers and strings show a note?

Mixed-type arrays are allowed since TOML 1.0, but tools that implement TOML 0.5 reject them. The note helps if your target tool is older.

Will 1.0 stay a float?

No. JSON stores 1.0 and 1 as the same number, so it becomes the integer 1. Write 1.5 or edit the TOML if the reading program needs a float.

Privacy

The conversion runs entirely in your browser. Your JSON and TOML are not uploaded or stored.