AnyFormat

00 JSON → TOML

JSON to TOML

For pyproject.toml, Cargo.toml and Hugo config.

01JSON in
02TOML out
  • No upload The conversion runs in this tab. Your file never travels — not to us, and not to the advertising.
  • No sign-up, no email, no daily cap There is no account system to sign up to.
  • No size limit we invented Only your device's memory — about ~2 GB on a desktop browser, ~400 MB on a phone.
  • Turn your Wi-Fi off and convert anyway The conversion needs nothing but this page. Ads will not load without a connection; your file will still convert. That is the whole claim, and it takes five seconds to check.

Paste JSON and get TOML — the configuration format used by Cargo, Python packaging and Hugo. Two of TOML's rules have no JSON equivalent, and both are explained below rather than producing a cryptic failure.

TOML needs an object at the root

A TOML document is a table: it must start with key/value pairs or a [header]. A JSON array at the top level cannot be expressed at all. Wrap it first — {"items": [ … ]} — and the array becomes an array of tables, which is TOML's [[items]] syntax.

TOML has no null

There is no null in TOML, deliberately: the format's position is that an absent key is the absent value. A JSON document containing null cannot be converted faithfully. Remove those keys, or replace the nulls with an empty string, before converting.

How nesting is written out

Nested objects become [table.subtable] headers rather than inline tables, because that is what hand-written TOML looks like and it stays readable at depth. Arrays of objects become [[array-of-tables]] blocks. Arrays of plain values stay inline in brackets.

TOML has no null

There is no way to write an absent value in TOML — the specification simply does not include one, on the grounds that a configuration key that exists but means nothing is a bug rather than a feature. So a JSON null cannot be represented, and the key is omitted rather than written as an empty string or the word null, either of which would be read back as a real value. If your consumer distinguishes an absent key from a present-but-empty one, check the result; this is the one conversion where the shape of the data genuinely changes rather than just its spelling.

Questions

Why was my top-level array refused?
TOML documents must start with key/value pairs or a table header. Wrap the array in an object under a key and it converts fine.
What happens to null values?
They cannot be converted — TOML has no null. Remove the keys or replace the values with an empty string first.
Are dates written as TOML date types?
No. JSON has no date type, so a date is a string in the input and stays a quoted string in the TOML. Unquote it by hand if you want a real TOML date.
Is my data uploaded anywhere?
No. The conversion runs as JavaScript inside this tab. Open your browser's Network panel and convert something — you will see no request carrying your data, because there is no server to send it to. You can also turn your Wi-Fi off and convert anyway.