TOML to JSON Converter
Paste a TOML file such as Cargo.toml, pyproject.toml or a config file and get clean JSON, or switch direction to turn JSON into readable TOML. The built-in TOML v1.0 parser runs in your browser and points to the exact line of any error.
Parsed by a built-in TOML v1.0 parser running in this tab; nothing is uploaded. Tip: Ctrl + Enter converts.
How to use the TOML to JSON Converter
- Choose the direction: TOML → JSON or JSON → TOML.
- Paste your file or open a .toml or .json file. A sample config is loaded to start.
- Read the result on the right. With Live update on it refreshes as you type; errors show the exact line and column.
- Adjust the options: JSON indentation, or whether ISO date strings become real TOML dates.
- Copy or download the output, or press Swap direction to convert it back.
Example: TOML and the equivalent JSON
| TOML | JSON |
|---|---|
|
|
TOML types and their JSON equivalents
| TOML | Example | JSON |
|---|---|---|
| Basic / literal string | "a\tb", 'C:\path' | string |
| Multi-line string | """…""", '''…''' | string with \n |
| Integer | 1_000, 0xFF, 0o755, 0b1010 | number (1000, 255, 493, 10) |
| Float | 3.14, 6.02e23, inf, nan | number, or the string "inf" / "nan" |
| Boolean | true | true |
| Offset date-time | 1979-05-27T07:32:00Z | string |
| Local date / time | 1979-05-27, 07:32:00 | string |
| Array | [1, "two", 3.0] | array |
| Table / inline table | [server], { x = 1 } | object |
| Array of tables | [[users]] | array of objects |
Common TOML errors
- Unquoted strings:
name = Adais invalid; writename = "Ada". - Duplicate keys or tables: defining
[server]twice, or the same key twice in one table, is an error in TOML. - Multi-line inline tables:
{ … }must stay on one line and cannot have a trailing comma. Use a[table]section for longer data. - Leading zeros:
port = 08080is invalid; numbers cannot start with 0 unless they are 0 or use a0x/0o/0bprefix.
Working with YAML too? Try the YAML to JSON converter or tidy the result in the JSON Formatter.
Frequently asked questions
Which TOML version is supported?
The converter implements TOML v1.0.0: key/value pairs with bare, quoted and dotted keys, standard tables, arrays of tables, inline tables, basic and literal strings (single and multi-line), integers in decimal, hex, octal and binary with underscores, floats including inf and nan, booleans, and all four date and time types. It also enforces the rules against duplicate keys and redefined tables.
How are TOML dates converted to JSON?
JSON has no date type, so dates are written as strings in the same RFC 3339 form as in the TOML file, for example 1979-05-27T07:32:00-08:00, 1979-05-27 (local date) or 07:32:00 (local time). A space between date and time is normalised to T.
What happens to inf and nan?
JSON cannot represent infinity or NaN, so these floats are written as the strings "inf", "-inf" and "nan", and a note tells you how many were converted.
How is JSON turned into TOML?
The top-level JSON object becomes the root table. Plain values are written first, then nested objects become [table] sections and arrays of objects become [[array of tables]] sections, the idiomatic TOML layout. Objects inside mixed arrays are written as inline tables, and multi-line strings use triple quotes.
Why are null values missing from the TOML output?
TOML has no null value. Keys whose value is null are left out, and the message tells you how many were removed. If you need to keep them, replace null with an empty string or a sentinel value in the JSON first.
Why does my JSON need to be an object?
A TOML document is always a table of key/value pairs, so it cannot be a bare array or a single value. Wrap an array in an object, for example {"items": [ … ]}, and it becomes [[items]] sections.
Is my file uploaded?
No. Parsing and conversion happen in JavaScript in this page, so configuration files with secrets or tokens never leave your device.