1001Ferramentas
⚙️ Converters

JSON to TOML

Convert JSON to TOML, the readable config format used by Cargo (Rust), pyproject.toml, Hugo, etc. Supports strings, numbers, booleans, arrays and nested tables. Everything in your browser.

Moving configuration from JSON to TOML

You have a block of configuration in JSON and the target wants TOML: pyproject.toml, Cargo.toml, a Hugo config, a netlify.toml. Rewriting it by hand is annoying because TOML flips the nesting model, turning every inner object into a bracketed table header. Paste the JSON on the left and the TOML appears on the right as you type.

Here is the rule the converter applies that people forget when writing TOML by hand: within each level, plain key equals value pairs come first and tables come after. That ordering is required, because in TOML everything following a header belongs to that table, so a loose key at the end of the file would land in the wrong one. That is why the key order in the output can differ from your JSON. Keys with dots, spaces or accents come out quoted.

Three limits are worth knowing before you paste the result. The root has to be an object: an array or a bare value returns an error, since TOML has no such concept at the root. null becomes an empty string, because TOML has no null. And an array of objects is emitted as an array of JSON strings, not as a double-bracket array of tables, so that part needs a manual pass. Dates stay strings. The whole conversion happens in your browser.

Frequently asked questions

Why do I get an error saying the root must be an object?
Because the JSON you pasted starts with a bracket or is a bare value. TOML only describes key-value pairs at the root, so wrap the array in a key, like {"items": [...]}
What happens to null values?
They become an empty string, two quote characters. TOML has no null, so whoever reads the file sees empty text rather than a missing field.
Does it convert TOML back to JSON?
No, this page only goes from JSON to TOML. For the other direction you need a different tool or a TOML parser in your language.

Related Tools