JSON1

JSON1 / TOML to JSON

TOML to JSON

Convert TOML to formatted JSON. Tables, table arrays, dotted keys, inline tables, and multi-line arrays are all supported.

Processed locally
InputTOML
Ready
OutputJSON

Converted output appears here as you type.

Good to know

  • JSON has no date type, so TOML datetimes are kept as strings.

About this tool

Two uses. One is inspection: TOML's section headers imply nesting that is not visible as indentation, so [tool.poetry.dependencies] looks flat and is three levels deep. Converting shows you the shape a tool actually receives. The other is scripting — pulling a version out of a Cargo.toml or a dependency list out of a pyproject.toml from something that only parses JSON.

Tables, [[array-of-tables]], dotted keys, inline tables, and arrays spread across several lines are all handled, including the nesting a dotted section header implies.

What happens to a TOML date?
It stays a string. TOML has first-class offset datetime, local datetime, date, and time types; JSON has none of them. 1979-05-27T07:32:00Z is preserved verbatim, which keeps the information intact and leaves the parsing to whatever reads the JSON.
How does a dotted key convert?
Into nesting. owner.name = "Ada" gives an owner object with name inside — the same result as an [owner] section with name under it, which is what TOML says those two spellings mean.
Why is [tool.poetry] two levels deep in the output?
Because a dot in a section header is nesting, not part of the name. [tool.poetry] is the poetry table inside the tool table, so the JSON has tool containing poetry. This is the single most common surprise when reading a pyproject.toml programmatically.
Are integers and floats distinguished?
They are in TOML, and JSON has only one number type, so 1 and 1.0 both become 1. Nothing is lost numerically, but a field you deliberately wrote as a float is no longer marked as one.