JSON to TOML Converter
Convert JSON to TOML format — objects become [tables], arrays of objects become [[arrays]].
or drop a file here
TOML output
title = "TOML Example" [owner] name = "Tom Preston-Werner" active = true [database] server = "192.168.1.1" ports = [8001, 8001, 8002] enabled = true [[servers]] ip = "10.0.0.1" role = "frontend" [[servers]] ip = "10.0.0.2" role = "backend"
How JSON to TOML conversion works
TOML (Tom's Obvious Minimal Language) is a configuration file format. JSON objects map to TOML [tables], arrays of objects become [[array of tables]], and scalar arrays use inline syntax key = [1, 2, 3]. Strings are quoted and special characters are escaped.
For the reverse conversion, use the TOML to JSON Converter. To format existing TOML, try the TOML Formatter. To convert between JSON and YAML, see JSON to YAML Converter.
Built and maintained by Meet Shah · Last updated
What this tool is used for
- Producing a TOML config for a Rust or Python project from a JSON source.
- Converting a generated JSON config into something more readable to edit.
- Getting the table syntax right for a structure you have in JSON.
- Producing a TOML fixture from an API response.
- Comparing a JSON config against a TOML one in the same format.
Frequently Asked Questions
- How does JSON nesting map onto TOML?
- A nested object becomes a `[section]` table with a dotted path, and an array of objects becomes repeated `[[section]]` table headers. TOML expresses a tree through header names rather than through indentation, so the conversion is mostly about turning depth into names.
- What has no TOML equivalent?
- `null`. TOML has no null type at all, so a null value is either omitted or has to become an empty string — a decision that changes meaning, since "absent" and "empty" are different to most consumers. It is the one conversion that cannot be lossless.
- Why does key order matter in the output?
- Because every key after a `[section]` header belongs to that table. Top-level keys must therefore be emitted before the first header, which is a structural requirement rather than a style preference — moving a line down a few rows silently reassigns it.
- How are mixed-type arrays handled?
- TOML 1.0 permits them; TOML 0.5 and earlier did not. A JSON array of mixed types therefore converts cleanly under the current spec and is rejected by older parsers, which is worth knowing when the target is a tool pinned to an older version.
- When is TOML the better format?
- For human-edited configuration with a known shape — Cargo, pyproject, Hugo. Its strictness is the point: quotes are required, types are explicit, and there is one obvious way to write things. For arbitrary nested data, JSON's uniformity is easier to generate and to parse.
Common errors and gotchas
- Producing deeply nested tables where TOML becomes harder to read than the JSON was.
- Ordering output incorrectly, since TOML requires a table's own keys before any sub-table.
- Assuming `null` converts. TOML has no null, so those keys must be omitted or given a default.
- Losing the array-of-objects distinction, which TOML expresses as a double-bracketed array of tables.
- Emitting a date-like string as a string when TOML has a real date type, or the reverse.
Related Converters tools
JSON to YAML
Convert JSON into clean, readable YAML instantly.
YAML to JSON
Convert YAML configuration into valid JSON.
JSON to XML
Convert JSON structures into nested XML markup.
HWB to HEX Converter
Convert an HWB color to HEX.
JSON to SQL
Turn a JSON array of objects into SQL INSERT statements.
CSV to XML
Convert CSV rows into structured XML records.
XML to CSV
Flatten repeated XML records into CSV rows.
INI to JSON
Parse INI config sections and keys into JSON.