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
JSON Result
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
- Paste your TOML, drop a .toml file on the box, or load it from a link with URL.
- Pick the JSON indentation, or Minified.
- Click Convert to JSON, or press Ctrl + Enter.
- Copy the result, download it, or send it to another tool with Open in.
Example
[package]
name = "weather-api"
version = "0.3.1"
[dependencies]
serde = { version = "1.0", features = ["derive"] }{
"package": {
"name": "weather-api",
"version": "0.3.1"
},
"dependencies": {
"serde": {
"version": "1.0",
"features": [
"derive"
]
}
}
}How TOML Types Become JSON
| TOML | JSON |
|---|---|
[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_000 | Number (large integers keep every digit) |
Floats, true / false | Number, boolean |
Dates and times, such as 1979-05-27 or 07:32:00 | String in the same format, e.g. "1979-05-27" |
inf, -inf, nan | The 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 = Emilyis invalid; writename = "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
tomllibmodule reads TOML:tomllib.load(open("pyproject.toml", "rb")), thenjson.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.