TOML to JSON Converter
Convert between TOML and JSON configuration formats instantly in your browser, ideal for Rust and Python project configs, Cargo files, and GitHub Actions settings. See exactly how TOML arrays of tables and nested values map to JSON structure, with no data sent to a server.
Usage examples
Reading a Rust or Python project's config
Cargo.toml, pyproject.toml, and similar config files are easier to scan as JSON when you need to check a nested value or feed it into another tool.
Migrating a config file to TOML
Have settings in JSON that a new tool expects in TOML? Paste the JSON in and get a TOML file with tables and arrays laid out correctly.
Inspecting a GitHub Actions or CLI tool's TOML settings
Convert a TOML config to JSON first to quickly diff it against another environment's settings or paste it into a JSON-based script.
Writing a GitHub Actions or Cargo config by hand
Draft the structure in JSON first if that's more comfortable, then convert to TOML for a Cargo.toml or similar file that requires it.
Checking what a TOML array of tables looks like in JSON
Convert a TOML file using "[[section]]" array-of-tables syntax to JSON to see clearly that it becomes a plain JSON array of objects.
Quick reference
TOML to JSON
| TOML | JSON |
|---|---|
| title = "TOML" | {"title":"TOML"} |
| lit = 'C:\path' | {"lit":"C:\\path"} |
| port = 8080 | {"port":8080} |
| big = 1_000_000 | {"big":1000000} |
| hex = 0xff | {"hex":255} |
| oct = 0o755 | {"oct":493} |
| bin = 0b1101 | {"bin":13} |
| pi = 3.14 | {"pi":3.14} |
| exp = 5e+22 | {"exp":5e+22} |
| enabled = true | {"enabled":true} |
| date = 1979-05-27 | {"date":"1979-05-27"} |
| dt = 1979-05-27T07:32:00Z | {"dt":"1979-05-27T07:32:00.000Z"} |
| time = 07:32:00 | {"time":"07:32:00.000"} |
| arr = [1, 2, 3] | {"arr":[1,2,3]} |
| mixed = [1, "a"] | {"mixed":[1,"a"]} |
| inline = { x = 1, y = 2 } | {"inline":{"x":1,"y":2}} |
| a.b.c = 1 | {"a":{"b":{"c":1}}} |
| "quoted key" = 1 | {"quoted key":1} |
| [server]\nhost = "localhost" | {"server":{"host":"localhost"}} |
| [[items]]\nid = 1\n[[items]]\nid = 2 | {"items":[{"id":1},{"id":2}]} |
| s = """\nline1\nline2""" | {"s":"line1\nline2"} |
JSON to TOML
| JSON | TOML |
|---|---|
| {"a": "text"} | a = "text" |
| {"a": 1.5} | a = 1.5 |
| {"a": "2024-01-15"} | a = "2024-01-15" |
| {"a b": 1} | "a b" = 1 |
| {"a": [1, "x"]} | a = [ 1, "x" ] |
| {"a": []} | a = [] |
| {"a": {"b": 1}} | [a]\nb = 1 |
| {"a": {}} | [a] |
| {"items": [{"id": 1}, {"id": 2}]} | [[items]]\nid = 1\n\n[[items]]\nid = 2 |
| {"a": null, "b": 1} | b = 1 (Note: TOML has no native null value, so keys with a null value were omitted from the output.) |
| [1, 2] | Conversion error: stringify can only be called with an object |
Frequently asked questions
Is my data sent to a server?
No. The conversion runs entirely in your browser using the smol-toml library. Nothing you paste is uploaded anywhere.
What happens to 'null' values when converting JSON to TOML?
TOML has no native representation for null. Keys whose value is null are silently dropped from the generated TOML rather than causing an error. If you need to preserve that information, consider using a sentinel value (like an empty string or a boolean flag) instead of null before converting.
Can every JSON structure be converted to TOML?
Most can, including nested objects (as TOML tables) and arrays. However, TOML is less flexible than JSON about mixing types within the same array and about top-level values that aren't objects, so unusual shapes may fail to convert — the error message will tell you what went wrong.
Does the converter preserve key order?
Yes, both directions preserve the order of keys as they appear in the source document.
Does the converter support TOML's date and time types?
Yes. TOML's native date, time, and date-time values are converted to their ISO 8601 string representation in JSON, since JSON has no native date type.
What's the difference between a TOML table and an inline table?
A regular table ('[section]') starts a new block that following keys belong to, while an inline table ('{ key = value }') is a compact, single-line object — both convert to the same kind of nested JSON object.
Can I convert just a fragment of a TOML file?
The input needs to be a complete, valid TOML document on its own — pasting an isolated fragment that depends on context from the rest of the file (like a bare key list without its table header) may fail to parse.