TOML to JSON Converter
Convert TOML to JSON in your browser with a full TOML v1.0.0 parser, pretty or minified.
Drag & drop a .toml file here, or click to browse
No uploads. Your file stays on your device.
JSON output โ the TOML above is invalid, so this is the last good conversion
Paste TOML above to see the JSON instantly.
How it works
Paste TOML above and a hand-written parser that follows the TOML v1.0.0
specification turns it into JSON as you type. It implements the whole grammar: bare, quoted
and dotted keys; basic, literal and multi-line strings with the full escape set and
line-ending backslashes; decimal, hexadecimal (0x), octal (0o) and
binary (0b) integers with _ separators; floats with exponents;
booleans; arrays; inline tables ({a = 1}); tables
([server]); and arrays of tables ([[product]]). Pick 2-space,
4-space or tab indentation, or Minified for the smallest payload, then copy or download.
Two things have no JSON equivalent, so the converter maps them and tells you when it did.
TOML's four date and time types (offset date-time, local date-time, local date and local
time) become ISO 8601 strings, with a space separator normalised to T. TOML's
inf and nan floats become null, because JSON cannot
write them, and integers above 2^53 lose precision as JavaScript numbers, so a note appears
above the output when either happens. Comments are dropped, as JSON cannot carry them.
Invalid TOML gets a line number and a plain-English reason instead of a silent failure, and
real spec violations such as duplicate keys, a table defined twice, or adding keys to an
inline table are reported rather than quietly accepted. Everything runs in JavaScript on your
own device: nothing is uploaded, so Cargo.toml, pyproject.toml and
config files holding tokens or hostnames never leave your machine.
Frequently asked questions
How do I convert TOML to JSON online?
Paste your TOML into the input box and the JSON appears instantly below it, no button to press. Pick 2-space, 4-space, tab or minified formatting, then use Copy JSON or Download .json. There is nothing to install and no account needed, so it works for a quick Cargo.toml or pyproject.toml lookup as well as a full config file.
Which parts of the TOML spec does this converter support?
It implements TOML v1.0.0 in full: bare, quoted and dotted keys; basic, literal and multi-line strings including the line-ending backslash; decimal, hexadecimal, octal and binary integers with underscore separators; floats with exponents; booleans; arrays; inline tables; tables; and arrays of tables. Real spec violations such as duplicate keys, a table defined twice, or adding keys to an inline table are reported with a line number instead of being quietly accepted.
What happens to TOML dates, inf and nan in the JSON output?
JSON has no date type, so the four TOML date and time types (offset date-time, local date-time, local date and local time) become ISO 8601 strings, with a space separator normalised to T. JSON also cannot write inf or nan, so those floats become null, and integers above 2 to the power of 53 lose precision as JavaScript numbers. A short note appears above the output whenever either of those mappings was needed, so nothing is lossy without you knowing.