🧷 JSON to TOML Converter
Paste JSON and get equivalent TOML for a config file, serialised locally, nothing uploaded.
serialized with @iarna/toml
How the json to toml converter works
The tool parses your JSON and serialises it as TOML with the @iarna/toml writer: top-level objects become tables, nested objects become sub-tables, and arrays are written as TOML arrays. The JSON must be an object at the top level, because a TOML document is always a set of key/value pairs. Concretely, {"owner":{"name":"Ada"}} is written as a [owner] header followed by name = "Ada", and an array of objects becomes a repeated [[…]] array-of-tables block. Scalar properties are emitted first, before any table header, because in TOML every key after a [table] line belongs to that table.
TOML is easier for people to read and edit than JSON for configuration, which is why tools are adopting it. Note that TOML has no null value and every key needs a value, so JSON containing null (or a top-level array or string) can't be represented, the tool tells you when that happens. It runs entirely in your browser.
Frequently asked questions
How do I convert JSON to TOML?
Paste a JSON object or load a .json file and the tool outputs TOML you can copy or download. Objects become tables and arrays become TOML arrays.
Why must the JSON be an object?
A TOML document is a collection of key/value pairs, so it needs an object at the top level. A top-level array, string or number has no TOML representation.
What about null values?
TOML has no null and requires every key to have a value, so JSON with null can't be converted. Remove or replace null values first; the tool flags this.
Why are scalar keys placed before the section headers?
In TOML, a bare key = value line belongs to whichever [table] most recently appeared. So any top-level scalar must be written before the first table header; otherwise it would silently be read as part of that table. The writer orders the output accordingly.
How are nested arrays of objects written?
As array-of-tables blocks: "servers": [{...},{...}] becomes two [[servers]] headers, each followed by that object's keys. A plain array of scalars, like ["a","b"], is written inline as ["a", "b"] on one line instead.
Why convert JSON to TOML at all?
TOML is easier for a person to read and hand-edit than JSON. It has comments, no trailing-comma traps, and clear [section] grouping, so it is a common choice for tool configuration (Cargo, pyproject, many Rust and Python tools). Converting a JSON config or API response to TOML gives you a starting config file you can then annotate and maintain by hand.
Do numbers, booleans and dates keep their types?
Yes, a JSON number is written as a bare TOML number, true/false as a TOML boolean, and a JSON string that is an ISO 8601 date is written as text (TOML has native date types, but the writer treats the value according to its JSON type). Only JSON null has no TOML equivalent, which is why the tool flags a document containing null.
Is my JSON uploaded?
No, the conversion runs locally in your browser and nothing is transmitted.