AZ Tools

TOML ↔ JSON Converter

Convert

TOML and JSON encode the same hierarchical config data with very different syntax. This converter walks both directions: paste a `Cargo.toml` or `pyproject.toml` to get the JSON shape your linter or generator expects, or feed a JSON config and get the TOML version that ships with Rust/Python tooling. Handles the parts of TOML that actually appear in the wild — top-level tables `[a.b]`, array-of-tables `[[a.b]]`, inline tables `{ k = v }`, inline arrays, basic strings, integers, floats with underscore separators, booleans, ISO dates and datetimes.

How to use

  1. Pick a direction. `TOML → JSON` parses your TOML into a JSON object; `JSON → TOML` does the reverse.
  2. Paste the source. Errors point to the line / character that broke parsing.
  3. Copy the result. The TOML output groups scalars first, then `[table]` sections, then `[[array.of.tables]]` blocks — the order most linters expect.

Frequently asked questions

Does it cover the full TOML spec?
It handles tables, dotted keys, inline tables, inline arrays, multi-line arrays, basic strings, multi-line basic strings, literal strings, integers with `_` separators, floats, booleans, RFC 3339 datetimes, and array-of-tables. Less common features (offset datetime arithmetic, escape sequence edge cases, very deeply nested mixed values) round-trip but may need a hand-edit.
Why does JSON → TOML reorder my keys?
TOML requires scalars to come before any `[table]` block within a section, because once `[table]` opens the next set of keys belongs to it. The serializer rearranges scalars first so the output parses back correctly — your top-level field meaning doesn't change.

Related tools