TOML to JSON Converter Online
Convert TOML tables, arrays and dates into JSON in your browser. Check the structure of a config file, and get an error instead of silently changed values for numbers JSON cannot hold.
See tables and arrays of tables in a config file as JSON objects and arrays.
Converted in your browser. Comments are omitted. Non-finite numbers and unsafe integers are rejected instead of silently losing their values.
When to use it
- See tables and arrays of tables in a config file as JSON objects and arrays.
- Pass a commented TOML file to a tool that only accepts JSON.
How to use
- Paste TOML or load an example (settings and tables, arrays of tables, dates and multi-line strings).
- Read the JSON on the right: [server] becomes an object and [[products]] becomes an array of objects.
- If there is an error, look for duplicate keys and quoting. Check strings, numbers and dates before copying.
TOML input
[[products]] code = "001" name = "Notebook" [[products]] code = "002" name = "Pen"
JSON output
{
"products": [
{ "code": "001", "name": "Notebook" },
{ "code": "002", "name": "Pen" }
]
}Details and limitations
Conversion runs in your browser. Comments, spacing and TOML quoting styles are not carried over.
JSON has no date type, so dates become strings; the time zone notation may be normalized. Quote values in TOML if you need them unchanged.
inf and nan do not exist in JSON, and integers are exact only up to ±9,007,199,254,740,991. Such values produce an error instead of null or rounded digits; write large IDs as strings.
Only TOML syntax is checked. Required fields of Cargo.toml, pyproject.toml or other formats are not validated.
FAQ
Can I convert wrangler.toml to JSON?
Yes for the structure: tables become objects and [[arrays]] become arrays of objects with the same key names. Comments are dropped, so compare the result with Cloudflare's Wrangler configuration docs before replacing your file.
How do I convert TOML to JSON in Python?
Python 3.11 and later include tomllib: python -c "import json,sys,tomllib; print(json.dumps(tomllib.load(open(sys.argv[1],'rb')), indent=2, default=str))" config.toml. default=str turns dates into strings, as this page does.
Can I keep leading zeros?
Write the value as a string, such as code = "001". Use quotes for identifiers you do not want treated as numbers.
Why does a large number cause an error?
JavaScript numbers cannot hold every large integer exactly, and JSON has no inf or nan. The conversion stops instead of changing the value; make exact IDs strings in TOML.