Skip to content

JSON ⇄ TOML

Converts between JSON and TOML, mapping nested objects onto table headers.

The JSON ⇄ TOML half of the same converter, for the moment a `Cargo.toml`, a `pyproject.toml` or a `netlify.toml` needs to become something a script can read — or the other way round. TOML is stricter than JSON about what a value may be, and the differences show up as warnings rather than surprises.

🔒 Runs entirely in your browserjsontomlconvert
From
Reading it as YAML.
To

Input

Drop a .yaml, .json or .toml file

Read in this tab. Nothing is uploaded.

JSON out

Written here rather than pulled from npm, which means the subset is chosen rather than inherited. Anything on this list is refused by name instead of being mis-read.

How to use it

  1. Paste the TOML, or the JSON

    Detection distinguishes the two easily — `[section]` headers and bare keys are unambiguous — but the From picker is there when you want to be sure.

  2. Set the target to TOML or JSON

    Going to TOML, tables are emitted as `[section]` headers rather than inline tables wherever the shape allows, which is what a hand-edited config looks like.

  3. Check what TOML could not hold

    Nulls are dropped, and date-times coming out of TOML become strings because JSON has no date type. Both are listed in the warnings when they happen.

Common questions

Why did my dates turn into strings?

TOML has first-class offset date-times, local dates and local times; JSON has none of them. Carrying the text across is the only lossless-looking option, and the round trip back into TOML will produce a quoted string rather than the original date literal.

Can it convert an array of mixed types?

Into JSON, yes. Into TOML the array is emitted as-is; TOML 1.0 permits heterogeneous arrays, but plenty of TOML readers in the wild — and TOML 0.5 — do not, so a mixed array is worth a second look before you commit it.

Does it catch duplicate keys?

Yes — a key defined twice, or a table redefined, is a TOML error and is reported as one rather than silently taking the last value the way a lenient reader would.

Feed it from

Next

These accept what this tool produces, so the result can go straight in.