FormatterHQ

TOML to JSON Converter

Turn TOML config files into JSON for scripts, APIs and tools that do not read TOML. Tables, arrays of tables and dates are mapped predictably.

Input TOML
Output JSON
Ready.

How to use the TOML to JSON Converter

  1. Paste TOML into the input editor, upload a .toml file, use Load URL, or click Sample.
  2. Choose the JSON Indent and tick Sort keys if you want alphabetical keys.
  3. Click Convert to JSON.
  4. Copy the JSON or Download it as a .json file.

Convert TOML to JSON without surprises

TOML is pleasant to write, but many programs, dashboards and APIs expect JSON. This TOML to JSON converter parses your file with a TOML 1.0 parser and emits the equivalent JSON, so you can feed a pyproject.toml into a script, compare two Cargo.toml files as data, or store configuration in a database column that expects JSON.

Example

# Project manifest
title = "inventory-service"
released = 2024-05-14

[database]
ports = [5432, 5433]
enabled = true

[[servers]]
name = "alpha"
role = "primary"

Converted with a 2-space indent:

{
  "title": "inventory-service",
  "released": "2024-05-14",
  "database": {
    "ports": [
      5432,
      5433
    ],
    "enabled": true
  },
  "servers": [
    {
      "name": "alpha",
      "role": "primary"
    }
  ]
}

How TOML maps to JSON

TOMLJSON
[table] and dotted keys a.b = 1nested objects
[[array.of.tables]]array of objects
inline table { x = 1 }object
integer (incl. 1_000, 0x1F)number
date 2024-05-14string "2024-05-14"
offset date-timeISO 8601 string, e.g. "1979-05-27T07:32:00.000-08:00"
inf, nannull (JSON has no equivalent)

Comments are dropped, since they are not part of the data. Key order follows the file unless you tick Sort keys, which sorts keys alphabetically at every level. The Indent option (2, 3 or 4 spaces or a tab) only affects how the JSON is laid out, not its content.

Edge cases

  • Big integers. TOML supports 64-bit integers, but JavaScript cannot hold values above 253 − 1 exactly, so such values are rejected with a clear error instead of being rounded.
  • Dates are strings in JSON. If your program needs real date objects, parse the strings after loading the JSON.
  • Nested arrays of tables are attached to the most recent parent element. A [[servers.ports]] header after [[servers]] adds a port to the last server, giving {"servers":[{"name":"a","ports":[{"n":80},{"n":443}]}]}.
  • Invalid TOML is reported with line and column, for example a key defined twice or an unquoted string value.

Typical uses

  • Reading project metadata in scripts. Convert pyproject.toml or Cargo.toml to JSON and query it with tools that understand JSON, such as jq, or the JSONPath tester.
  • Sending configuration to an API. Many deployment and CMS APIs accept settings as JSON while the source of truth lives in a TOML file.
  • Comparing environments. Two TOML files with different layouts can hold the same data. Converting both to JSON with Sort keys ticked makes them directly comparable.
  • Checking structure. The JSON makes it obvious whether a key landed in the table you intended, which is easy to get wrong with dotted keys and arrays of tables.

Most languages ship with a JSON parser in the standard library, while TOML support often needs an extra package. Converting once can remove that dependency from a small script or a build step.

Round trips and related conversions

Need to go back? The JSON to TOML converter writes TOML from JSON, though comments and original formatting cannot be recovered. To inspect the file without converting it, the TOML validator shows the same structure, and the JSON to YAML converter can take the result on to YAML.

Privacy

The conversion runs in your browser; your configuration is not uploaded. Our server is involved only if you use Load URL or Save & Share.

Frequently asked questions

How do I convert pyproject.toml to JSON?
Upload the file or paste its content, then click Convert to JSON. Tables such as [project] and [tool.black] become nested objects in the result.
Why are my TOML dates strings in the JSON?
JSON has no date type, so dates, times and date-times are written as ISO 8601 strings. Offset date-times are normalized to include milliseconds.
What happens to comments?
They are removed. Comments are ignored by TOML parsers and have no place in the JSON data model.
Can I convert JSON back to TOML?
Yes, with the JSON to TOML converter. The data round-trips, but comments and your original layout are not restored.

Last updated September 26, 2026

Guides

Related tools