JSON to TOML

Convert JSON into TOML.

The JSON to TOML converter turns a JSON object into TOML text, updating as you type. Because TOML has no null value and always starts with a table, JSON with a null or a non-object top level is rejected with an explanatory message. Use it to build config files from existing JSON data.

How does JSON map to TOML?

TOML is a configuration format built on key-value pairs and tables. A JSON object becomes a TOML table, nested objects become [section] tables, arrays of objects become arrays of tables written as [[name]], and strings, numbers and booleans map directly. The mapping is not complete in both directions. TOML requires the top-level value to be a table, so a JSON document that is a bare array or scalar cannot be a TOML document. TOML has no null type, so a JSON null cannot be represented, whether it is a value or an array element. JSON has no date type either, so a string such as "2024-01-05" stays a string in the TOML. The layout of the output is decided by the writer, but the data stays the same.

How to use JSON to TOML

  1. Paste JSON Enter a JSON object in the JSON pane.
  2. Review the TOML The TOML pane updates automatically.
  3. Resolve errors If a message mentions null or the top-level value, adjust the JSON and the result refreshes.
  4. Copy or download Copy the TOML or save it as output.toml.

Frequently asked questions

Why can't null be converted?

TOML deliberately has no null type, so there is no way to write it.

Can the top level be an array?

No. A TOML document must be a table, so wrap the array in an object.

Will the output match my existing TOML file exactly?

Not necessarily. The data is equivalent, but the order and layout are chosen by the writer.

How are arrays of objects written?

As arrays of tables using double-bracket headers like [[users]].

Are comments or dates created?

No. JSON carries neither, so you add comments by hand and date values stay strings.

Is my data uploaded?

No. The conversion runs in the page and the text you enter is not sent anywhere.