Skip to content
ToolMug

JSON to TOML Converter

Turn JSON into TOML for Rust's Cargo.toml, Python's pyproject.toml, Hugo and application config. Nested objects become [tables], arrays of objects become [[arrays of tables]], and invalid JSON is reported with the line number.

Runs in your browser — nothing you enter is uploaded

JSON → TOML
Output (TOML)

How to use

  1. Paste JSON on the left, or click Load sample.
  2. The TOML appears as you type. If the JSON is invalid, the error shows the line where it fails.
  3. Copy or download the TOML, or click Swap direction to convert TOML back to JSON.

Options explained

null values
TOML has no null. Keys and array items that are null are omitted, and a comment on the first line lists the omitted paths.
Non-object root
A TOML document must be a table at the top level. If the JSON root is an array or a single value, it is placed under an items key and a comment says so.
Tables and arrays of tables
Nested objects are written as [a.b] tables, arrays whose items are all objects as [[a]] arrays of tables, and other arrays inline.

Example

JSON:

{"server":{"host":"0.0.0.0","port":8080},"databases":[{"name":"main","url":"postgres://db:5432/app"}]}

TOML:

[server]
host = "0.0.0.0"
port = 8080

[[databases]]
name = "main"
url = "postgres://db:5432/app"

Frequently asked questions

What is the difference between TOML and JSON?

TOML is a config format meant to be written by hand. It has comments, sections and date-time values, and is used by Cargo, pyproject, Hugo, Netlify and others. JSON is better for exchanging data between programs and has no comments.

Why did 1.0 become 1?

Once JSON is parsed in JavaScript, 1 and 1.0 are the same number, so it is written as an integer. If a field must be a float, change it to 1.0 in the TOML.

Does it keep the order of keys?

Plain key/value pairs keep their JSON order. TOML requires [tables] and [[arrays of tables]] to come after plain keys, so those move to the end.

Is my data uploaded?

No. Parsing and conversion run in your browser, which matters for configs containing tokens or passwords.

Privacy

This tool runs entirely in your browser. Your files and text are processed on your device and are never uploaded to our servers.

Related tools