Skip to content
PithLab

↑↓ to move · Enter to open · Esc to close

TOML to JSON and JSON to TOML Converter

Convert between TOML and JSON, with clear errors and date handling.

Use via API

Convert TOML to JSON or JSON to TOML (TOML 1.0). TOML dates become ISO 8601 strings in JSON; notes explain anything that can't be represented exactly. Send JSON, get JSON back.

POST https://pithlab.com/api/v1/tools/toml-json-converter

curl https://pithlab.com/api/v1/tools/toml-json-converter \
  -H "Authorization: Bearer $PITHLAB_KEY" \
  -H "Content-Type: application/json" \
  -d '{"input":"[server]\nhost = \"0.0.0.0\"\nport = 8080\n\n[database]\nurl = \"postgres://localhost/app\"\npool = 5","to":"json"}'

Fields and responseOpenAPI documentGet an API key

About the TOML to JSON Converter

Convert TOML to JSON and JSON to TOML in your browser. Shows the line and column of syntax errors, keeps dates as ISO strings and explains what TOML cannot hold.

How to use the TOML to JSON Converter

  1. Choose TOML to JSON or JSON to TOML.
  2. Paste your document, or press Example. The result updates as you type.
  3. If there is a syntax error, the message gives the line and column to look at.
  4. Read any notes about dates or values that changed type, then copy or download the result.

Examples

TOML with a table and a date to JSON

Input

title = "TOML Example"

[owner]
name = "Tom"
dob = 1979-05-27T07:32:00-08:00

[database]
ports = [8000, 8001]
enabled = true

Output

{
  "title": "TOML Example",
  "owner": {
    "name": "Tom",
    "dob": "1979-05-27T07:32:00-08:00"
  },
  "database": {
    "ports": [
      8000,
      8001
    ],
    "enabled": true
  }
}
JSON to TOML with an array of tables and a date string

Input

{"name":"app","version":"1.2.0","deps":{"react":"^19.0.0"},"servers":[{"host":"a","port":80},{"host":"b","port":81}],"release":"2026-10-19"}

Output

name = "app"
version = "1.2.0"
release = 2026-10-19

[deps]
react = "^19.0.0"

[[servers]]
host = "a"
port = 80

[[servers]]
host = "b"
port = 81

Frequently asked questions

What happens to TOML dates and times in JSON?

JSON has no date type, so offset date-times, local date-times, local dates and local times are written as ISO 8601 strings, such as "1979-05-27T07:32:00-08:00" or "07:30:00". A note lists every value that was converted.

Why does JSON to TOML fail on null?

TOML has no null value. The error names the exact path, such as $.server.timeout, so you can remove the key or give it a real value. The top level must also be an object, because a TOML document is always a table.

Can TOML arrays mix types?

Yes. Since TOML 1.0, arrays may mix strings, numbers and tables, so a JSON array like [1, "two"] converts fine. The converter follows TOML 1.1 using the smol-toml library.

Why did 1.0 become 1 in my TOML?

JSON readers do not keep the difference between 1 and 1.0, so whole numbers are written as TOML integers. Very large integers in TOML are kept exactly when converting to JSON, but some JSON tools may round them.

Are my config files uploaded?

No. Parsing and conversion happen in your browser, so secrets in config files never leave your device.