Convert JSON to TOML in your browser
TOML is the config format behind Cargo.toml, pyproject.toml and many other
tools, but data often arrives as JSON. This converter turns a valid JSON
object into clean TOML that targets the TOML v1.0.0 syntax, so you can paste
it straight into a config file.
How it works
The converter maps each JSON construct to its TOML equivalent:
| JSON | TOML |
|---|---|
| nested object | [table] header with dotted path |
| array of objects | [[array of tables]] entries |
| array of scalars | inline array, e.g. tags = ["a", "b"] |
| string | basic-string quoting with escapes |
| number / boolean | written as-is |
| null | empty string (TOML has no null) |
Keys that are not bare-key safe (containing spaces or special characters) are quoted automatically. TOML requires an object at the top level, so the input must be a JSON object.
Example
This JSON:
{ "name": "demo", "deps": { "serde": "1.0" }, "tags": ["fast", "free"] }
becomes:
name = "demo"
tags = ["fast", "free"]
[deps]
serde = "1.0"
The scalar array stayed inline, and the nested deps object became a [deps]
table. The conversion happens entirely in your browser — your config is never
uploaded or stored.
How TOML compares to JSON for config
TOML was designed specifically for configuration files, with human readability as a first-class concern. The key differences from JSON that matter for config:
- No quotes around keys.
name = "demo"instead of"name": "demo"— less visual noise. - Comments. TOML allows
# ...comments on any line; JSON does not. This is the biggest practical difference for hand-edited config files. - Tables and arrays of tables are syntactically distinct from inline objects and arrays.
[server]followed byhost = "localhost"is clearer than a nested JSON object for configuration blocks. - Dates and times are first-class types.
date = 2026-01-15is a native TOML date value, not a string — handy for release dates, expiry times, and scheduling config.
Common use cases for this converter
- Migrating a JSON config to a Rust project. Cargo.toml uses TOML; if your settings are currently in
config.json, convert here first. - Setting up a pyproject.toml. Python packaging moved from
setup.pytopyproject.toml— converting your existing JSON tooling config is a quick starting point. - Hugo static site config. Hugo accepts
hugo.tomlin addition to YAML; converting from a JSON config file is straightforward here. - Translating API responses to local config. Some APIs return configuration as JSON; if your runtime reads TOML, convert once and edit as needed.