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·Your data never leaves your device
InputTOML
ReadyOutputJSON
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:00Zis 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 anownerobject withnameinside — the same result as an[owner]section withnameunder 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 thepoetrytable inside thetooltable, so the JSON hastoolcontainingpoetry. This is the single most common surprise when reading apyproject.tomlprogrammatically. - Are integers and floats distinguished?
- They are in TOML, and JSON has only one number type, so
1and1.0both become1. Nothing is lost numerically, but a field you deliberately wrote as a float is no longer marked as one.
Related tools
- JSON to TOMLConvert JSON to TOML. Nested objects become tables, arrays of objects become table arrays, and everything else inlines.
- JSON to YAMLConvert JSON to YAML. Strings that would otherwise read as booleans, numbers, or nulls are quoted so the result parses back to the same value.
- JSON to KotlinGenerate Kotlin data classes with kotlinx.serialization from a JSON sample. A SerialName annotation is added only where the JSON key differs from the property name.