Skip to content
Tools

TOML to JSON Converter

Last updated:

Paste TOML and get the same data as formatted JSON: [tables] become nested objects, [[double-bracket]] sections become arrays of objects and comments are dropped. A syntax error is reported with its line and column, so you can fix a Cargo.toml or pyproject.toml without guessing.

Runs in your browser: your TOML never leaves your device – nothing is uploaded, logged or stored on a server. How we protect your data

100% in-browserNothing is uploaded

Input

Loading editor…

Paste TOML here

or drop a file anywhere in this box. Everything stays in your browser.

Drop a file to load it

Output

Loading editor…

JSON appears here

Results update as you type.

How to use the TOML to JSON

  1. Paste TOML or drop a .toml file (Cargo.toml, pyproject.toml, Hugo or Netlify config).
  2. If the parser stops, go to the reported line and column; the message names the rule that was broken.
  3. Look at dates and times in the output: JSON has no date type, so they come out as quoted strings.
  4. Copy or download the JSON, or pick 2 spaces, 4 spaces or tab for the indent.

Worked example

A service config with a date, a 64-bit id and two job tables

TOML

# build config for the billing service
name = "billing-api"
build_id = 9007199254740993
released = 2026-10-29T08:00:00Z
ratio = 2.0

[database]
host = "db.internal"
ports = [5432, 5433]

[[jobs]]
name = "nightly"
retries = 3

[[jobs]]
name = "weekly"
retries = 1

JSON

{
  "name": "billing-api",
  "build_id": 9007199254740993,
  "released": "2026-10-29T08:00:00.000Z",
  "ratio": 2.0,
  "database": {
    "host": "db.internal",
    "ports": [
      5432,
      5433
    ]
  },
  "jobs": [
    {
      "name": "nightly",
      "retries": 3
    },
    {
      "name": "weekly",
      "retries": 1
    }
  ]
}

build_id is above 2^53, yet every digit survives, because integers are never squeezed through a JavaScript number. The date became a string, 2.0 stayed 2.0 and the comment is gone.

TOML types and the JSON they become

Every TOML 1.0 value has a JSON form except inf and nan.

TOML types and the JSON they become
TOMLJSONWatch out
port = 80808080Integers of any size keep all digits
mask = 0xFF255Hex, octal and binary are written in decimal
big = 1_000_0001000000Underscores are only a reading aid
pi = 3.143.14A float with no fraction is written 2.0, not 2
when = 2026-10-29T08:00:00Z"2026-10-29T08:00:00.000Z"Milliseconds are added; finer digits are cut
day = 2026-10-29"2026-10-29"A local date stays date-only
at = 07:32:00"07:32:00.000"A local time has no date or zone
x = inf or nanErrorJSON cannot hold either one

Why the output is not always a drop-in replacement

TOML distinguishes integers from floats, and JSON does not, so 2.0 stays 2.0 to keep the distinction visible. Many JSON parsers read that as the same number as 2 and that is harmless. A parser that maps integers to a strict type might not, so check the field types in the program that reads the result.

Float values are re-printed from a 64-bit double. Write a very long decimal, such as 3.14159265358979323846, and the extra digits are dropped, as they would be in most programs. If you need exact decimals, keep them as strings in the TOML.

Tables, dotted keys and arrays of tables

A dotted key such as server.http.port = 80 and a header such as [server.http] with port = 80 below it create the same nested object. Defining the same key or table twice is an error, and the message gives the second line. An empty file converts to {}, which is a valid TOML document.

Each [[servers]] header appends one more object to the servers array. Keys that follow a header belong to that table until the next header, which is the usual reason a value ends up in the wrong place.

TOML to JSON FAQ

How do I convert TOML to JSON in Python?

Python 3.11 and later read TOML with tomllib: import tomllib, json; print(json.dumps(tomllib.load(open('f.toml','rb')), default=str)). The default=str part turns dates into text.

Why is my date wrapped in quotes in the JSON?

JSON has no date type, so a TOML date or time has to become a string. It is written in ISO 8601 form, which JavaScript's Date and most libraries parse back directly.

Does the converter lose big integers?

No. TOML integers are 64-bit, and larger values are accepted here too. Every digit is kept in the JSON, but a JavaScript JSON.parse will round anything above 9007199254740991 when you load it.

Can I convert Cargo.toml or pyproject.toml?

Yes. Paste the whole file. Cargo's [dependencies] table becomes an object whose keys are crate names, and pyproject's [[tool.*]] sections follow the same array rules as any other TOML.

What does the error with a line and column mean?

The parser stopped at that position because the text broke a TOML rule, such as a missing value after =, a string without a closing quote or a key defined twice. Fix that spot first; later errors often disappear.

Related tools