Output appears here.
JSON to TOML converts a JSON object into a TOML document: nested objects become [tables], arrays of objects become [[arrays of tables]], and everything else maps to TOML strings, numbers, booleans and arrays. Use it to write Cargo.toml, pyproject.toml or app config from existing data. Everything runs in your browser — nothing is uploaded.
How to convert JSON to TOML
- Paste JSON or drop a
.jsonfile. The top level must be an object, because a TOML document is always a table. - Read the result and any notices. There are no settings: the mapping from JSON to TOML is fixed, and anything TOML cannot express —
null— is reported rather than guessed. - Copy or download the
.tomlfile, use Format TOML to open it in the TOML Formatter, or Back to JSON to check the round trip.
Examples
Package config
Nested objects become table headers. An object nested two levels deep, like dependencies.serde, gets a dotted header:
{"package":{"name":"formattr","version":"1.0.0"},"dependencies":{"serde":{"version":"1.0","features":["derive"]}}}Result:
[package]
name = "formattr"
version = "1.0.0"
[dependencies.serde]
version = "1.0"
features = [ "derive" ]Array of tables
An array whose items are all objects becomes a repeated [[servers]] block — the TOML way to write a list of records:
{"servers":[{"name":"alpha","ip":"10.0.0.1"},{"name":"beta","ip":"10.0.0.2"}]}Result:
[[servers]]
name = "alpha"
ip = "10.0.0.1"
[[servers]]
name = "beta"
ip = "10.0.0.2"Null values
TOML has no null. Keys with null values are left out, null items are dropped from arrays, and a notice lists what was removed:
{"title":"App","owner":null,"debug":false,"retries":3,"ratio":0.75,"tags":["a",null,"b"]}Result:
title = "App"
debug = false
retries = 3
ratio = 0.75
tags = [ "a", "b" ]Notice: "TOML has no null — removed 2 null values (owner, tags[1])."
Options explained
This converter has no settings. The output follows the TOML 1.0 specification directly:
- Objects become tables, with simple keys written first and sub-tables after them.
- Arrays of objects become arrays of tables; other arrays, including nested arrays and mixed types, stay inline.
- Keys that are not valid bare keys —
"a b","key.with.dots"— are quoted automatically. - Integers stay integers and fractional numbers become floats.
For different spacing, run the result through the TOML Formatter.
Common conversion errors
"TOML documents must be a table (a JSON object) at the top level."
The input is an array or a single value. Wrap it in an object with a key, for example {"items": [...]}, and the array becomes [[items]].
Some keys disappeared
They held null. The notice lists the paths. If the key must exist, give it a real value such as "", false or 0, or document the default in a comment after conversion.
Dates came out as quoted strings
JSON has no date type, so "2026-09-26T09:00:00Z" is a string and stays one. If you want a native TOML datetime, remove the quotes in the result: released = 2026-09-26T09:00:00Z.
A float such as 3.0 became 3
JSON does not distinguish 3.0 from 3, so a whole number is written as a TOML integer. Large integers, by contrast, are copied digit for digit: 9007199254740993 stays 9007199254740993. If a key must be a float, such as a version or a ratio read by a strict loader, edit the result to 3.0.
A syntax error points at the JSON
The JSON itself is invalid — usually single-quoted strings or input that was cut off. Comments and trailing commas are tolerated and ignored, but other mistakes stop the conversion. Fix them with the JSON Validator, which shows the exact line and column.
FAQ
Why must the top level be an object?
A TOML document is always a table of key/value pairs. There is no way to write a bare array or number as a whole document. Wrap arrays in an object with a meaningful key; the key becomes the table name, which also documents what the list contains.
How do I get [[double bracket]] tables?
Use a JSON array whose elements are all objects, like "servers": [{...}, {...}]. Each element becomes one [[servers]] block. If any element is not an object, the array is written inline instead, because TOML arrays of tables can only contain tables.
Will converting back give me the same JSON?
For objects, arrays, strings, booleans and numbers, including integers larger than 2^53, yes — use Back to JSON to check. Nulls do not survive the trip, and a float like 3.0 returns as 3, because JSON does not distinguish them.
Can I keep comments when converting?
JSON has no comments, so there is nothing to carry over. Add comments to the TOML output afterwards; the TOML Formatter keeps them when you reformat the file later.
Is my JSON uploaded during conversion?
No. Parsing and conversion run in your browser inside an isolated frame that blocks network requests. Nothing is stored unless you turn on "Remember my last input".
JSON to TOML type mapping
| JSON | TOML | Note |
|---|---|---|
| object | table [name] or inline value |
Top level must be an object |
| array of objects | array of tables [[name]] |
|
| array of scalars | array [ 1, 2 ] |
Mixed types allowed (TOML 1.0) |
| string | basic string "..." |
ISO date strings stay strings |
| integer | integer | Every digit kept, even beyond 2^53 |
| fraction | float | |
| true / false | boolean | |
| null | removed | Reported in a notice |
Related tools
Reverse the conversion with TOML to JSON, or produce YAML instead with JSON to YAML. More converters are listed under Data.