TOML to JSON

Turn TOML config into JSON, with dates normalised to ISO 8601.

Reverse
Input
TOML input
Output
Result
Options

Spaces per level of nesting.

About this tool


TOML to JSON is a clean conversion in almost every respect: tables become nested objects, arrays of tables become arrays of objects, and TOML's explicit types map onto JSON types directly. The one thing JSON cannot hold is TOML's native date and time values.

This is the direction you need when a build tool, CI step or script wants JSON but your project configuration lives in Cargo.toml or pyproject.toml.

How to use it

  1. Paste or upload TOMLDrop a .toml file or paste the config text.
  2. ConvertPress Convert to JSON, or use Ctrl+Enter.
  3. Fix any errorParse failures report the exact line and column so you can find the problem quickly.
  4. Copy or downloadSave as .json or copy the result.

Worked examples


Each example below is executed against this tool by the test suite, so what you see is what the tool actually produces.

Tables, arrays of tables and a date

Input

title = "My App"

[owner]
name = "Ada"
dob = 1979-05-27

[[servers]]
host = "alpha"

[[servers]]
host = "beta"

Output

{
  "title": "My App",
  "owner": {
    "name": "Ada",
    "dob": "1979-05-27"
  },
  "servers": [
    {
      "host": "alpha"
    },
    {
      "host": "beta"
    }
  ]
}

The TOML local date becomes an ISO 8601 string, keeping its date-only form; both [[servers]] blocks become elements of one array.

What to watch for


The details that decide whether a conversion is correct, and where information can be lost without any error being raised.

Tables become nested objects
A [server] header becomes a "server" object, and [server.tls] nests a "tls" object inside it. Dotted keys behave the same way: a = { b = 1 } and a.b = 1 both produce {"a":{"b":1}}. The flat, header-based layout of TOML becomes a conventional JSON tree.
Arrays of tables become arrays of objects
Each [[products]] block becomes one element of a "products" array. Unlike XML, TOML is unambiguous here: a single [[products]] block still produces a one-element array, so the JSON shape does not change with the number of entries. Code consuming it can always iterate safely.
Dates and times become ISO 8601 strings
TOML has four date-ish types (offset date-time, local date-time, local date and local time), and JSON has none. Each is converted to an ISO 8601 string, which is the standard interchange form. This is the one lossy part of the conversion: a local date-time with no timezone is rendered in UTC, so the fact that it was deliberately zone-less is not preserved.
Comments are dropped
TOML # comments have no JSON equivalent and are discarded. Config files are usually well commented, so keep the TOML as your source of truth rather than treating the JSON as canonical.
Numbers, and where precision matters
TOML integers are specified as 64-bit signed, but JSON numbers are IEEE 754 doubles, so an integer above 2^53 loses precision on conversion. TOML also allows underscores for readability (1_000_000) and hex, octal and binary literals; all are converted to ordinary decimal JSON numbers. The special floats inf and nan have no JSON representation.

Limitations


  • Comments are lost, as JSON cannot represent them.
  • TOML date and time types become ISO 8601 strings, losing the distinction between zoned and local values.
  • Integers above 2^53 lose precision when converted to JSON numbers.
  • The TOML floats inf and nan have no JSON equivalent.
  • Processing happens in your browser, so very large inputs are bounded by available memory. Files above roughly 10 MB are handled but will feel slower, and multi-hundred-megabyte files are better suited to a command-line tool.

Questions


Why is my date a string?
JSON has no date type, so TOML dates become ISO 8601 strings, which is the interchange convention and sorts correctly as text. The precision you wrote is kept: a local date stays 1979-05-27, while an offset date-time keeps its time and zone.
Do single [[table]] blocks produce an array?
Yes. Unlike XML, TOML is explicit about arrays of tables, so one block gives a one-element array and the JSON shape stays stable regardless of count.
Are hex and underscore-separated numbers supported?
Yes. 0xFF, 0o755, 0b1010 and 1_000_000 are all valid TOML and convert to ordinary decimal JSON numbers.