Back to Developer
TOML ⇄ JSON converter — Cargo.toml / pyproject.toml

TOML ⇄ JSON converter — Cargo.toml / pyproject.toml

Convert TOML to JSON or JSON to TOML. Switch direction, choose JSON indent (2 / 4 / tab), and try the sample button. Powered by smol-toml — runs entirely in your browser.

developerJSONconversion

How to use

Pick a direction (TOML → JSON or JSON → TOML), paste your text, then press Run. For TOML → JSON you can choose the JSON indent (2 / 4 spaces or Tab). We parse/emit via the TOML 1.0.0 compliant `smol-toml` library, so tables, array-of-tables, datetimes, and multi-line strings all round-trip. The sample button preloads typical config. Copy or download the result as .json / .toml.

FAQ

Is my input uploaded anywhere?
No. Conversion runs in your browser via local JavaScript — nothing leaves your device.
Which TOML version is supported?
TOML 1.0.0 (via the smol-toml library). Tables `[table]`, array-of-tables `[[array]]`, inline tables, multi-line strings, and datetime literals are all supported.
Why do null-valued keys disappear in JSON → TOML?
TOML has no null type, so keys whose value is null are dropped from the output. To keep them, replace null with a TOML-representable value such as an empty string "" or false.
How are TOML datetimes (e.g. 2024-03-15) represented in JSON?
TOML datetime literals are parsed as Date objects and become ISO 8601 strings in the JSON output. Going the other way, JSON strings stay strings — they are not auto-promoted to TOML datetimes (remove the quotes in TOML if you want a real datetime).
Are comments preserved?
JSON has no comment syntax, so TOML → JSON drops comments. JSON → TOML produces no comments either.
Why merge TOML→JSON and JSON→TOML into one tool?
Both directions are the same concept. A direction toggle keeps them in a single UI. The indent option only affects JSON output, so it appears only in TOML → JSON mode.

Related tools