About the TOML to JSON Converter tool
TOML is the configuration format behind Rust’s Cargo.toml, Python’s pyproject.toml, Hugo sites, Netlify, Deno tooling and many other projects. It is pleasant to write, but sooner or later you need the same data as JSON: to feed a script, inspect a nested value, or compare settings. This converter parses TOML in your browser and prints the equivalent JSON.
The parser is written for this site and follows the TOML 1.0 rules. It understands [tables], [[arrays of tables]], dotted keys like server.port, inline tables { a = 1 }, arrays that span several lines with comments and trailing commas, basic and literal strings, both multi-line forms including line-ending backslashes, hexadecimal, octal and binary integers, underscores in numbers, floats with exponents, booleans, and offset or local date-times, dates and times.
Mistakes are caught the way a real TOML loader would catch them: duplicate keys, a table defined twice, a key with no value, an unterminated string or a number with a leading zero are all reported with the line and column. Because JSON has no date type, dates become ISO 8601 strings, and integers too large for JavaScript are kept as strings so no digits are silently rounded.
How to use TOML to JSON Converter
- Paste TOML into “TOML input”, open a .toml file, or click “Load sample” for a Cargo-style manifest.
- Fix any error using the line and column shown.
- Choose the “JSON indent” for the output.
- Copy the “JSON output” or download it as a .json file.
Features
Full TOML 1.0 syntax
Tables, arrays of tables, dotted keys, inline tables and every string type are supported.
Precise errors
Duplicate keys, redefined tables and bad values are reported with line and column.
Safe big integers
Integers beyond 2^53 are kept as strings instead of losing digits.
All number formats
Hex 0x, octal 0o, binary 0b, underscores and exponent floats are converted correctly.
When to use it
- Read a Cargo.toml or pyproject.toml from a script that only understands JSON.
- Inspect the merged structure of a Hugo or Netlify configuration.
- Validate a hand-written TOML file before a deployment picks it up.
- Convert TOML test fixtures into JSON for a JavaScript test suite.
Frequently asked questions
What is TOML?
TOML (Tom’s Obvious, Minimal Language) is a configuration format with key = value pairs grouped into [tables]. It maps directly to a hash table, which is why it converts cleanly to JSON.
How are TOML dates converted?
JSON has no date type, so dates and times are written as ISO 8601 strings, for example "2024-06-01T08:30:00Z". A space between date and time is normalised to T.
What happens to inf and nan?
JSON cannot represent infinity or not-a-number, so these TOML floats are written as the strings "inf", "-inf" or "nan".
Are comments kept?
No. Comments are not part of the data, so they do not appear in JSON, which has no comment syntax.
Can I convert JSON back to TOML?
Yes, use the JSON to TOML converter on this site.