TOML to JSON Converter
Convert TOML to JSON and JSON to TOML instantly. Supports tables, arrays, inline tables, and all TOML data types. Free, browser-based, no upload required.
- Runs in your browser
- Your data never leaves your browser
- Free · No Sign-Up
Scan with WeChat to share this tool
Examples, details and FAQ Worked examples, how it compares with other tools, and answers to common questions.
Worked Examples
Simple table
Input TOML:
[database]
host = “localhost”
port = 5432
enabled = true
Output JSON: { "database": { "host": "localhost", "port": 5432, "enabled": true } }, indented with two spaces.
Array of tables
Two [[fruits]] entries become one array, and each entry keeps only the keys it has:
[[fruits]]
name = "apple"
[[fruits]]
name = "banana"
color = "yellow"
{
"fruits": [
{ "name": "apple" },
{ "name": "banana", "color": "yellow" }
]
}
(The tool indents every object over several lines; it is shortened here.) A pyproject.toml works the same way:
[tool.ruff.lint] becomes "tool": { "ruff": { "lint": { ... } } }, and keys with dashes such as
requires-python are kept as written.
JSON to TOML: a package.json
Pasting this JSON into the right panel:
{"name":"demo","version":"1.0.0","private":true,"scripts":{"build":"astro build","test":"node --test"},"workspaces":["packages/*"],"engines":{"node":">=22"}}
gives:
name = "demo"
version = "1.0.0"
private = true
workspaces = [ "packages/*" ]
[scripts]
build = "astro build"
test = "node --test"
[engines]
node = ">=22"
Plain values are written first and nested objects follow as [tables], because in TOML every key after a table header
belongs to that table. Keys that are not bare words are quoted: {"my key": 1, "a.b": 2} becomes
"my key" = 1 and "a.b" = 2, so a dot inside a JSON key is not turned into nesting.
TOML vs JSON
TOML (Tom’s Obvious Minimal Language) is a configuration file format designed to be easy to read due to its obvious semantics.
It is widely used in Rust projects (Cargo.toml), Hugo, and many other tools.
JSON is the standard data interchange format for APIs and web services.
This tool converts between them; the differences between the two type systems are listed under “What Changes in Conversion” below.
What Changes in Conversion
TOML has types that JSON lacks, and the reverse. This input:
# build settings
title = "x"
created = 2026-09-29T10:00:00Z
day = 2026-09-29
[server]
port = 8080
converts to:
{
"title": "x",
"created": "2026-09-29T10:00:00.000Z",
"day": "2026-09-29",
"server": {
"port": 8080
}
}
-
Comments are dropped. JSON has no comments.
-
Dates and times become strings. An offset date-time gains milliseconds (
.000Z). Converting the JSON back gives a quoted string, not a TOML date. -
Times finer than milliseconds stop the conversion to JSON. The TOML parser keeps milliseconds and drops further digits, which TOML 1.0 allows a parser to do.
started = 2026-10-01T09:30:00.123456Zin a[build]table givesNot converted: JSON cannot hold these values without changing them: /build/started: 2026-10-01T09:30:00.123456Z has more than millisecond precision. Trailing zeros, as in.120000, lose nothing and convert. Dates and times inside strings and comments are text and are not checked. -
infandnanstop the conversion to JSON. JSON has no infinity or NaN, andJSON.stringifywould writenull. This TOML:ratio = inf [limits] max = nangives
Not converted: JSON cannot hold these values without changing them: /ratio: inf has no JSON form (JSON.stringify would write null); /limits/max: nan has no JSON form (JSON.stringify would write null). -
Integers outside ±(2^53 − 1) stop the conversion in both directions. TOML 1.0 allows 64-bit integers, but the TOML parser stops with
integer value cannot be represented losslesslyrather than round them. In JSON → TOML,JSON.parsewould round them, so the field is listed instead; a number too large for a double, such as1e400, is listed too. -
JSON
nullstops the conversion to TOML. TOML has no null. This JSON:{"user":{"id":9007199254740993,"nickname":null}}gives
Not converted: TOML cannot hold these values without changing them: /user/id: integer 9007199254740993 is outside ±(2^53 − 1), so JavaScript would round it; /user/nickname: null — TOML has no null. Quote large IDs as strings and replace or remove nulls, then convert again. -
A failed conversion clears the output panel and disables its Copy button, so an earlier result is not copied by mistake.
-
-0.0keeps its sign both ways. The JSON{"offset":-0.0}givesoffset = -0.0, a TOML float, and TOMLoffset = -0.0gives"offset": -0.0(JSON.stringifyalone would write0). The JSON integer-0givescount = 0for{"count":-0}: TOML 1.0 says-0and+0are the same integer as0. -
JSON
1.0becomes TOML1.JSON.parsedoes not keep the difference between1.0and1, so a float that happens to be whole is written as a TOML integer. Write1.5-style values or fix the type by hand if your program checks it. -
The JSON root must be an object.
[1, 2]givesstringify can only be called with an object, because a TOML document is always a table. -
Redefinitions are errors. TOML such as
a = 1followed by[a]givestrying to redefine an already defined table or valuewith the line and a caret.
For the same data in YAML, use the YAML ↔ TOML converter; to check a JSON file before converting it, use the JSON formatter.
FAQ
What TOML features are supported?
All standard TOML v1.0 features are supported via the smol-toml library: tables, arrays of tables, inline tables, dotted keys, multi-line strings, integers, floats, booleans, datetimes, and arrays.
Can JSON arrays of objects be converted to TOML?
Yes. JSON arrays of objects become TOML arrays of tables ([[table.name]] syntax). Primitive arrays become TOML inline arrays.
What happens to JSON null values?
TOML does not have a null type, so the conversion stops and lists each null field by its path (for example /user/nickname). Replace or remove the nulls and convert again.
Is my data sent anywhere?
No. All conversion runs in your browser. Your data never leaves your machine.