Skip to content
ZeroServer.tools

TOML to JSON Converter

Convert TOML configuration files (Cargo.toml, pyproject.toml…) to JSON.

or drop a file here

TOML format and conversion notes

TOML (Tom's Obvious, Minimal Language) is a config-file format used by Rust (Cargo.toml), Python (pyproject.toml), Hugo, and others. Key features: [sections] become JSON objects, [[arrays]] become arrays of objects, dotted keys like a.b = 1 create nested objects. TOML special floats (inf, nan) are converted to null since JSON has no equivalent. Datetimes are preserved as ISO 8601 strings. All processing runs in your browser. Related: XML to YAML converter and JSON formatter.

Built and maintained by Meet Shah · Last updated

What this tool is used for

  • Reading a TOML config into a tool or an API that consumes JSON.
  • Checking exactly how a TOML parser resolved your types and tables.
  • Producing a JSON fixture from a project's configuration.
  • Comparing two TOML files by converting both and diffing the JSON.
  • Confirming that a date or a time was parsed as a typed value.

Frequently Asked Questions

How cleanly does TOML map to JSON?
Very, in that direction. Tables become objects, arrays of tables become arrays of objects, and the scalar types line up — TOML was designed to map unambiguously onto a hash table, so this is one of the few conversions that loses almost nothing.
What is the one thing that does not map?
Dates. TOML has first-class date, time and datetime types; JSON has no date type at all, so they become strings. The value survives and the type does not, which is the only real information loss in the conversion.
What happens to comments?
They are lost, because JSON has no comment syntax. In a configuration file the comments frequently carry the reasoning behind the values, so a TOML-to-JSON conversion of a human-maintained config discards the part that was hardest to write.
Does key order survive?
JSON objects are unordered by specification, though every practical parser preserves insertion order. Relying on it is safe in JavaScript and unsafe as a general assumption — and TOML's own ordering rules around table headers do not survive either way.
Why convert at all?
Because tooling expects JSON. TOML is authored by people and JSON is consumed by programs, so the conversion is usually a build step feeding a tool that has no TOML parser — which is why the direction matters more than the round trip.

Common errors and gotchas

  • Losing TOML's typed dates and times, which JSON can only represent as strings.
  • Assuming key order is preserved and meaningful, which neither format guarantees.
  • Dropping comments, which TOML supports and JSON cannot hold.
  • Flattening arrays of tables in a way that no longer round-trips.
  • Expecting JSON to keep the distinction between an integer and a float that TOML made explicit.

Related Converters tools

Private & free — this tool runs entirely in your browser.

IndieKitShip your Next.js startup in days.affiliate