Skip to content
My Tiny Utils

Search tools

Type to find a tool, then press Enter to open it.

TOML to JSON Converter

Convert TOML to JSON and JSON back to TOML with a full TOML 1.0 parser — dates, inline tables, arrays of tables, and precise line-and-column errors.

Processed locally in your browser — nothing is uploaded.

TOML to JSON Converter

0 characters

JSON

Output appears here…

About the TOML to JSON Converter

Paste a TOML file — a Cargo.toml, pyproject.toml, Hugo or Netlify config, or anything else — and get the same data as JSON. Switch to JSON → TOML to go the other way, or press Swap to send the output back through the opposite converter. Because the converter has to read every line of the file, it doubles as a TOML validator: if the file isn't valid TOML, you get the line, the column, and a caret under the exact character, along with what's wrong ("Duplicate key "name" (first defined on line 3)", "Booleans are lowercase in TOML").

The parser implements the whole TOML 1.0 specification rather than the easy 90% of it. It passes the official toml-test suite for TOML 1.0 — every valid document parses to the expected value and every invalid one is rejected. That includes the rules most hand-rolled parsers get wrong: a [table] can't be defined twice, a table created with dotted keys can't be reopened with a header, inline tables are closed once written, [[arrays.of.tables]] can nest, and a [sub.table] header after [[array]] attaches to the array's last element.

How TOML types map to JSON

  • Tables and inline tables become objects, with keys in the order they were written.
  • Arrays of tables ([[products]]) become arrays of objects.
  • Integers keep every digit. TOML integers are 64-bit, so 9223372036854775807 is valid TOML — the JSON output writes it exactly, and the tool warns you that JavaScript's JSON.parse would round anything beyond ±2^53.
  • Floats stay recognizably floats: 1.0 is written as 1.0, not 1, so converting back gives you a float again.
  • Dates and times have no JSON type, so offset date-times, local date-times, local dates, and local times all become RFC 3339 strings such as "1979-05-27T07:32:00-08:00" or "07:32:00". A space separator or lowercase z is normalized to T and Z, and fractional seconds keep the precision you wrote.
  • inf, -inf and nan aren't valid JSON either, so they're written as the strings "inf", "-inf" and "nan", and the tool lists where they were.

Converting JSON to TOML

The JSON → TOML direction writes idiomatic TOML: plain keys first, then [tables], then [[arrays of tables]]. Tables that only hold other tables don't get a header of their own, keys are quoted only when they have to be, strings with line breaks become """ multi-line strings, and strings full of backslashes — Windows paths, regexes — become 'literal strings' that need no escaping. Long arrays break onto one item per line.

Some JSON can't be expressed in TOML, and the converter says so instead of guessing. TOML has no null, so a null value is an error that names its path ("db.hosts[1]" is null) — or, if you'd rather drop them, turn on Skip null values in Options. A TOML document is always a table, so the top level of the JSON must be an object. Integers beyond 64 bits are refused with a suggestion to quote them. Strings that are valid RFC 3339 dates stay strings unless you turn on Write dates as TOML dates, which makes a TOML → JSON → TOML round trip lossless.

Example

Input

[server]
host = "localhost"
ports = [8080, 8443]
started = 2026-10-12T09:30:00Z

[[users]]
name = "ada"

Output

{
  "server": {
    "host": "localhost",
    "ports": [
      8080,
      8443
    ],
    "started": "2026-10-12T09:30:00Z"
  },
  "users": [
    {
      "name": "ada"
    }
  ]
}

The date-time becomes an RFC 3339 string and the [[users]] array of tables becomes an array of objects.

Limitations

  • TOML comments have nowhere to go in JSON, so they're dropped, and a JSON → TOML conversion can't invent them.
  • TOML 1.1 additions — newlines and trailing commas in inline tables, \e and \xHH escapes, times without seconds — are reported as errors, because TOML 1.0 is what Cargo, pip, Poetry, and most other tools read today.
  • Telling 1 from 1.0 and keeping integers over 2^53 exact in the JSON → TOML direction relies on your browser exposing the original number text to JSON.parse. Recent Chrome, Edge, and Firefox do; elsewhere whole-number floats like 1.0 come out as the integer 1.
  • Key order inside a JSON object can't be fully preserved on the way to TOML: JavaScript lists integer-like keys such as "2" before the others.

Frequently asked questions

How do I convert a TOML file to JSON?

Paste the contents of the .toml file into the TOML box and the JSON appears as you type. Copy it or download it as converted.json. Choose 2-space, 4-space, or minified output in Options.

Can I convert JSON back to TOML?

Yes. Switch to the JSON → TOML tab, or press Swap to move the current output across. The converter writes plain keys first, then [tables], then [[arrays of tables]], quotes keys only when needed, and uses multi-line strings for text with line breaks.

What happens to TOML dates when converting to JSON?

JSON has no date type, so all four TOML date and time kinds become RFC 3339 strings, like "1979-05-27T07:32:00Z" or "07:32:00". The tool tells you how many it converted. Going back, turn on "Write dates as TOML dates" to turn those strings into real TOML dates again.

Why does JSON to TOML fail on null?

TOML has no null value — a key either has a value or is absent. The error names the path of the first null so you can fix it, or you can turn on "Skip null values" in Options to leave those keys and array items out.

Can I use this as a TOML validator?

Yes. The converter is a complete TOML 1.0 parser, so invalid TOML is reported with the line and column of the problem, a caret under the exact character, and a plain-English reason such as a duplicate key, a table defined twice, or an unquoted string.

What's the difference between [table] and [[table]] in TOML?

[table] defines a single table, which becomes a JSON object. [[table]] adds an element to an array of tables, so writing [[products]] three times gives a JSON array of three objects. A [products.details] header after [[products]] belongs to the most recent element.

Does the converter support inline tables and dotted keys?

Yes. Inline tables like point = { x = 1, y = 2 } and dotted keys like site."google.com".enabled = true both become nested JSON objects. TOML's rules are enforced too: an inline table can't be extended after it's written, and a table made with dotted keys can't be reopened with a [header].

Is my config file uploaded anywhere?

No. Parsing and conversion run entirely in your browser, which matters for config files that hold database URLs, API keys, or internal hostnames.