Convert JSON to TOML

Turn JSON into a TOML config file.

TOML

About this converter

TOML is what Rust's Cargo.toml, Python's pyproject.toml and a growing number of config files are written in, so this is usually a step in moving a configuration from one ecosystem to another.

One thing can stop it outright: a TOML document must begin with a table, so JSON that is a bare list at the top level cannot be written as TOML at all. Wrap it in a named key and it converts. That is a real limit of the format rather than of this page, and it is said plainly rather than producing something that will not parse.

Nested objects become [sections] and lists of objects become [[array-of-table]] blocks, which is what makes TOML readable as configuration — and what makes it a poor fit for deeply nested data, where the section headers grow longer than the values.

Frequently asked questions

Why can a list not be converted?

Because a TOML file is a table from its first line — there is no syntax for a document that is only a list. Wrap it: {"items": [ … ]} converts fine and produces [[items]] blocks.

What does TOML do with deeply nested data?

It handles it, but not gracefully — every level adds to the section header, so four levels down you get [a.b.c.d] above two short values. TOML was designed for configuration a person edits. If your data is deeply nested, YAML or JSON will read better.

What happens to null?

There is no null in TOML — the specification deliberately leaves it out. A key with a null value is dropped rather than written as an empty string, since an empty string is a different thing and guessing between them would be worse.

Does what I paste get sent anywhere?

No. The conversion runs in your browser, on your own machine, which is why the result appears as you type. What you paste is not uploaded or logged.

Related tools