TOML to JSON Converter

Convert TOML config files, such as Cargo.toml, pyproject.toml or hugo.toml, into clean JSON. Follows TOML 1.0, keeps large integers exact, and marks the exact line of any error. Runs in your browser, so your files are never uploaded.

TOML Input

Ln 1, Col 1Empty

JSON Result

Your result will appear here.
No result yet

What Is TOML?

TOML (Tom's Obvious, Minimal Language) is a config file format built to be easy for people to read and write. Version 1.0 came out in 2021. You meet it in Rust's Cargo.toml, Python's pyproject.toml, Hugo and Netlify settings and many other tools. This converter turns that TOML into JSON, so you can use it in a script or an API, or simply see what the file really contains.

How to Convert TOML to JSON

  1. Paste your TOML, drop a .toml file on the box, or load it from a link with URL.
  2. Pick the JSON indentation, or Minified.
  3. Click Convert to JSON, or press Ctrl + Enter.
  4. Copy the result, download it, or send it to another tool with Open in.

Example

TOML
[package]
name = "weather-api"
version = "0.3.1"

[dependencies]
serde = { version = "1.0", features = ["derive"] }
JSON
{
  "package": {
    "name": "weather-api",
    "version": "0.3.1"
  },
  "dependencies": {
    "serde": {
      "version": "1.0",
      "features": [
        "derive"
      ]
    }
  }
}

How TOML Types Become JSON

TOMLJSON
[table] and inline tables { a = 1 }Object
[[array of tables]]Array of objects
Strings: basic, literal '...' and multi-line """..."""String
Integers, also hex 0xFF, octal 0o17, binary 0b101 and 1_000Number (large integers keep every digit)
Floats, true / falseNumber, boolean
Dates and times, such as 1979-05-27 or 07:32:00String in the same format, e.g. "1979-05-27"
inf, -inf, nanThe strings "inf", "-inf", "nan" (JSON has no such numbers)

Comments (# ...) are not data, so they do not appear in the JSON. When dates or inf/nan values are turned into text, the message under the tool says so.

Common TOML Errors

  • Defining a key or table twice, e.g. two [package] sections: "trying to redefine an already defined table or value".
  • A value is missing after =, or a string has no closing quote.
  • A table header is not closed, like [profile.release.
  • Strings without quotes: unlike YAML, name = Emily is invalid; write name = "Emily".

The error message shows the line and column, and the line is marked so you can fix it quickly.

Tips

  • Need it the other way round? Use JSON to TOML.
  • Working with YAML configs too? See YAML to JSON and JSON vs YAML.
  • In Python 3.11 and newer, the built-in tomllib module reads TOML: tomllib.load(open("pyproject.toml", "rb")), then json.dumps() writes JSON.

Frequently Asked Questions

How do I convert TOML to JSON?

Paste your TOML or drop a .toml file into the converter and click Convert to JSON. Tables become objects, arrays of tables become arrays of objects, and the result can be copied or downloaded.

What happens to TOML dates?

JSON has no date type, so TOML dates and times become strings in the same format, for example "1979-05-27" or "07:32:00".

Are large integers kept exactly?

Yes. Integers larger than JavaScript can hold safely keep every digit in the JSON output instead of being rounded.

Is my TOML uploaded?

No. The conversion runs in your browser and your file never leaves your device.

Related Tools