TOML ↔ JSON Converter
Convert between TOML (Cargo.toml, pyproject.toml, Hugo configs) and JSON — handles tables, array-of-tables, inline tables, typed scalars.
How to use
- Pick a direction.
TOML → JSONparses your TOML into a JSON object;JSON → TOMLdoes the reverse. - Paste the source. Errors point to the line / character that broke parsing.
- Copy the result. The TOML output groups scalars first, then
[table]sections, then[[array.of.tables]]blocks — the order most linters expect.
About this tool
ShowHide
TOML and JSON describe the same shape of configuration data with very different syntax, and this converter walks both directions. Paste a Cargo.toml or a pyproject.toml to get the JSON your linter, generator or script expects, or feed it JSON and get the TOML that Rust and Python tooling actually ships. It handles the parts of TOML that turn up in real files: tables [a.b], arrays of tables [[a.b]], inline tables, inline arrays, basic and literal strings, integers, floats with underscore separators, booleans and dates.
The conversion is not symmetric, and the asymmetry is TOML's missing null. JSON has one, TOML does not — the convention there is to omit the key entirely. Going from JSON to TOML this tool writes an empty string rather than dropping the key, so the structure survives and the distinction between "absent" and "explicitly nothing" does not. If that difference carries meaning in your schema, handle those keys before converting rather than after.
Dates are the other place the two formats genuinely disagree. TOML has first-class date and time types, including a local date-time that deliberately carries no offset; JSON has only strings. This converter keeps a date-time verbatim as it was written, which is a deliberate choice rather than laziness: parsing one into a date object and formatting it again would resolve that missing offset against the viewer's time zone, so the same pyproject.toml opened in Seoul and in Lisbon would produce two different JSON documents. Keeping the text means the value that arrives is the value that was there.
Two smaller notes. TOML integers are 64-bit signed by specification while JSON numbers are doubles in most parsers, so a value past 2^53 does not survive the round trip intact in JavaScript — a build number or a snowflake ID is the usual casualty. And a.b = 1 and [a] with b = 1 mean exactly the same thing in TOML, so two files that look nothing alike can convert to identical JSON, which is worth remembering before concluding that a diff has found a real change.
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.
Why does a value I meant as text come back as a date or a number?
Because TOML types bare values by their shape: a bare 2026-03-15 is a date, 1.20 is a float that prints as 1.2, and 0x1F is an integer. Anything whose exact text matters — a version, a phone number, an identifier with a leading zero — has to be quoted. It is the same trap YAML sets, with a stricter and better-specified set of rules behind it.
Which TOML shape does an array of objects become?
An array of tables, written as repeated double-bracket headers rather than as a bracketed list. The result is verbose but readable, which is the trade TOML makes throughout. Round-tripping through JSON therefore does not preserve your original layout: comments are lost, inline tables may come back expanded, and key order follows the document rather than what you wrote.
Related tools
JSON ↔ YAML Converter
Convert JSON to YAML or YAML to JSON — pick the indent and copy the result.
Convert
XML ↔ JSON Converter
Convert XML to JSON and back, with full attribute support, configurable attribute prefix and text key.
Convert
INI ↔ JSON Converter
Round-trip between INI-style config files and JSON — supports sections, dotted nesting, comments, and value type inference.
Convert
Fixed-Width Text Parser to CSV / JSON
Split fixed-width / fixed-column text into fields by column widths and export as CSV or JSON, in your browser.
Convert
CSV → HTML / Markdown / JSON Table
Convert CSV to an HTML <table>, a Markdown table, or a JSON array of objects — auto-detects the delimiter.
Convert
JSON → SQL INSERT
Turn a JSON array of objects into INSERT statements — PostgreSQL, MySQL, SQLite, or ANSI quoting, with an optional ON CONFLICT upsert tail.
Convert