Skip to content

Menu

TOML ↔ JSON Converter

Convert between TOML and JSON formats with section and array-of-tables support

Runs entirely in your browserFormattersFree, no sign-up
Loading tool

01What is TOML ↔ JSON Converter?

TOML is pleasant to edit by hand, which is why Cargo.toml and pyproject.toml use it. JSON is what most scripts, jq and APIs expect. This converter moves data between the two in either direction and updates as you type. On the TOML side, a full parser follows the TOML 1.0 spec published at toml.io. It understands bare, quoted and dotted keys. It reads basic and literal strings, single-line and multi-line, with every escape sequence. Integers can be decimal, hex, octal or binary, with underscores. Floats, inf, nan, booleans, offset and local date-times, multi-line arrays, inline tables, [tables] and [[arrays of tables]] are all supported. Invalid TOML is rejected with a line number rather than guessed at. That covers duplicate keys, tables defined twice, leading zeros and unterminated strings. Tables become JSON objects and arrays of tables become arrays of objects. JSON has no date type, so dates and times come out as strings, exactly as written in the TOML. JSON also has no inf or nan, so those become null. Going the other way, a JSON object becomes TOML with plain keys first. Then each nested object gets a [table] section and each list of objects gets [[array of tables]] sections. Arrays of simple values stay inline. Keys that aren't safe as bare keys are quoted, so "my key" keeps its quotes. Strings are escaped as TOML basic strings. A small example: the TOML lines released = 2024-05-27T07:32:00Z, day = 1979-05-27, port = 8_080 and hex = 0xff give a JSON object with two date strings, port 8080 and hex 255. Some JSON simply has no TOML form. TOML has no null, so a null value stops the conversion with an error naming the key. It isn't dropped silently. The top level also has to be an object, since a TOML document is always a table. You can load the Cargo.toml, pyproject.toml or Package JSON example, then copy or download the result. The conversion runs inside your browser tab, so private config values stay local.

Rust and Python developers who need their Cargo.toml or pyproject.toml data as JSON for scripts, or JSON config turned into TOML. The tool runs entirely in your browser, so your data never leaves your device.

02How to use TOML ↔ JSON Converter

  1. Pick the TOML → JSON or JSON → TOML tab, or load the Cargo.toml, pyproject.toml or Package JSON example.
  2. Paste your TOML or JSON into the input panel. The output updates as you type.
  3. If a red error appears, fix the line or key it names.
  4. Click Copy to copy the result, or Download to save it as a file.

03Worked examples

Input: TOML to JSON: [package] name = "demo" version = "0.1.0" [dependencies] serde = { version = "1.0", features = ["derive"] }
Result: { "package": { "name": "demo", "version": "0.1.0" }, "dependencies": { "serde": { "version": "1.0", "features": [ "derive" ] } } }
An inline table like serde = { ... } becomes an ordinary nested JSON object, the same as a [dependencies.serde] section would.
Input: TOML to JSON: released = 2024-05-27T07:32:00Z day = 1979-05-27 port = 8_080 hex = 0xff
Result: { "released": "2024-05-27T07:32:00Z", "day": "1979-05-27", "port": 8080, "hex": 255 }
JSON has no date type, so TOML dates come out as strings, while underscores and hex in integers are resolved to plain numbers.
Input: TOML to JSON: [[bin]] name = "a" [[bin]] name = "b"
Result: { "bin": [ { "name": "a" }, { "name": "b" } ] }
Each [[bin]] header appends one object to the bin array.
Input: JSON to TOML: {"title":"x","owner":{"name":"Tom","tags":["a","b"]},"servers":[{"ip":"10.0.0.1"},{"ip":"10.0.0.2"}]}
Result: title = "x" [owner] name = "Tom" tags = ["a", "b"] [[servers]] ip = "10.0.0.1" [[servers]] ip = "10.0.0.2"
Nested objects become [tables] and arrays of objects become [[arrays of tables]]; top-level plain values are written first.
Input: JSON to TOML: {"a":null}
Result: Error: TOML has no null value: remove "a" or give it a value
Input: TOML to JSON: server.http.port = 80 x = inf
Result: { "server": { "http": { "port": 80 } }, "x": null }
Dotted keys nest objects. inf has no JSON form, so it becomes null.

04Common use cases

  • Converting a Cargo.toml or pyproject.toml to JSON so a CI script or jq can read a version number
  • Turning a JSON config into TOML for a tool that only reads TOML
  • Checking that a hand-edited TOML file is valid before committing it
  • Seeing how dotted keys and [[arrays of tables]] map onto nested JSON
  • Feeding TOML settings into a JavaScript test fixture that expects JSON
  • Finding out which JSON values, such as null, have no TOML equivalent before a config migration

05Tips

  • TOML's [[name]] headers build arrays of tables. In a Cargo.toml, each [[bin]] becomes one object in a JSON bin array.
  • Dotted keys like server.http.port = 80 create the same nested objects as a [server.http] header.
  • Dates stay strings in JSON. Parse them in your own code if you need real date objects.
  • Replace null values before converting JSON to TOML. Remove the key or pick a sensible empty value.
  • inf and nan turn into null in JSON, so check float fields if a round trip back to TOML fails.

06Related concepts

TOML v1.0.0, Cargo.toml, pyproject.toml, INI format.

Frequently Asked Questions

What is TOML ↔ JSON Converter?

TOML ↔ JSON Converter is a free, browser-based developer tool on AIDToolStack. Convert between TOML and JSON formats with section and array-of-tables support It requires no installation or sign-up and works entirely in your browser.

Is TOML ↔ JSON Converter free to use?

Yes. No sign-up, no fees and no usage cap.

Does TOML ↔ JSON Converter store my data?

No. It runs in your browser; nothing is uploaded.

Cheat sheet

Related Tools

Reviews and commentsShow

Reviews

Sign in to leave a review.

Loading reviews…

Comments

Sign in to leave a comment.

Loading comments…

What changed in AI dev tools, once a month

Renames, shutdowns, pricing changes and new MCP setups, each with a source.

Subscribe