JSON to TOML Converter
Paste a JSON object on the left, get TOML on the right. Runs entirely in your browser — nothing is uploaded.
What this tool does
It parses a JSON document with the browser's own JSON.parse, then walks the resulting object and emits it as TOML 1.0. Nested objects become tables ([owner], [owner.profile]), arrays of objects become arrays-of-tables ([[servers]]), and scalars carry their JSON type straight across — strings stay quoted, numbers and booleans stay bare.
The intent it closes: "I have a JSON config (or an API response, or a generated settings blob) and the tool I'm feeding it wants TOML." The usual destinations are a Cargo.toml, a pyproject.toml, a Hugo or Zola config.toml, or any Rust/Go service that reads TOML at startup.
One rule the spec forces on you up front: TOML has no null. The Nulls option decides what happens to JSON nulls before emission — there is no way to write a literal null into valid TOML, so the converter must drop them or replace them.
When you'd reach for it
- Seed a
Cargo.tomlorpyproject.tomlfrom generated JSON. A script produced JSON settings and the project file needs TOML — paste and convert. - Turn an API response into a config file. Save a JSON payload as a readable
.tomlyou can hand-edit and check into version control. - Strip nulls on the way in. Leave Nulls on Drop and every
nullkey vanishes — the fastest way to clean an export that TOML would otherwise reject. - Alphabetize while you convert. Pick Alphabetical sort to land a tidy, diff-stable file instead of whatever order the JSON happened to use.
- Keep records as arrays-of-tables. A JSON array of objects converts to TOML's
[[name]]blocks — the idiomatic way to express a list of records. - Convert secrets safely. The parse and emit run in your tab, so a JSON file full of keys never leaves the machine.
How the conversion works
One click of Convert runs three stages.
1. Parse the JSON
The input goes through JSON.parse. If it isn't valid JSON, the status bar shows the parse error and nothing is emitted. The root must be an object — a top-level array, string, or number has no TOML equivalent and is rejected with JSON root must be an object to convert to TOML.
2. Resolve nulls
Before anything is written, the tree is walked for null (and undefined) values. Under Drop they're removed from objects and spliced out of arrays; under Empty string each becomes "". This pass is unavoidable because TOML cannot represent absence as a value the way JSON can.
3. Emit TOML
The cleaned tree is emitted by the same canonical writer the formatter uses, so it honours the Sort and Inline ≤ options. Plain objects become table headers, arrays of objects become arrays-of-tables, and leaf objects small enough for the Inline ≤ threshold are written as inline { … } tables.
Options reference
Nulls
Drop (TOML has no null) removes any key whose value is null, and removes null entries from arrays — the right default, because it produces clean, valid TOML. Empty string keeps the key but writes "" instead, which is what you want when a downstream reader expects the key to exist even when blank.
Sort
Preserve order writes keys in the order JavaScript reports them (essentially source order for string keys). Alphabetical sorts every table's keys A–Z. Alpha, tables last sorts A–Z but pushes table-valued and array-of-table keys after the scalars, so name and version sit above [dependencies] in each section.
Inline ≤
The maximum number of keys a leaf object can have and still be written as an inline table ({ a = 1, b = 2 }) rather than a [section] header. 0 means "never inline" — every nested object gets its own header. Try 3 to keep tiny coordinate-style objects compact while letting larger ones expand.
Output and mapping rules
- Objects → tables. Nested objects become dotted table headers (
[owner.profile]) unless they fit the Inline ≤ threshold. - Arrays of objects → arrays-of-tables.
[ {…}, {…} ]becomes repeated[[name]]blocks. - Arrays of scalars → inline arrays.
[1, 2, 3]stays a one-line array. - Numbers and booleans carry across unquoted; strings stay quoted.
- Dates. JSON has no date type, so an ISO date that lives in JSON as a string stays a quoted string. Delete the quotes by hand if you want a native TOML datetime.
- Keys with spaces or punctuation are quoted automatically (
"my key" = 1) so the output stays valid. - Download:
output.toml, content typetext/plain;charset=utf-8.
Example
Input:
{
"project": "TOML Kit",
"meta": {
"version": 1.2,
"tags": ["web", "tools"]
},
"servers": [
{ "ip": "10.0.0.1", "role": "frontend" },
{ "ip": "10.0.0.2", "role": "backend" }
]
}
Output (defaults — Drop nulls, Preserve order, Inline ≤ 0):
project = "TOML Kit"
[meta]
version = 1.2
tags = ["web", "tools"]
[[servers]]
ip = "10.0.0.1"
role = "frontend"
[[servers]]
ip = "10.0.0.2"
role = "backend"
The nested meta object becomes a [meta] table; the servers array of objects becomes two [[servers]] blocks — TOML's array-of-tables syntax for a list of records.
Recipes by intent
Clean a JSON export that TOML rejects
Leave Nulls on Drop. Every null field disappears and the output parses as valid TOML on the first try — no hand-editing to chase down the offending key.
Produce a diff-stable config file
Set Sort to Alphabetical. The same JSON always yields byte-identical TOML regardless of key order in the source, so re-running the conversion never churns your version control.
Keep blank keys instead of losing them
Switch Nulls to Empty string. A reader that checks for the presence of a key (rather than its truthiness) still sees it, now holding "".
Compact small objects, expand big ones
Set Inline ≤ to 3. Two- and three-key leaf objects stay inline (point = { x = 1, y = 2 }) while anything larger gets its own [section] — a readable middle ground.
Limits and performance
- In-memory. The JSON string, the parsed tree, and the TOML output all sit in memory at once. Config-sized files are instant; multi-megabyte JSON can take a moment to walk and emit.
- The textarea is the bottleneck on huge output. Past tens of megabytes, painting the result back into the right pane lags after the conversion itself finishes — use Download .toml rather than Copy.
- No streaming. A top-level array of millions of records isn't a valid TOML root anyway; for bulk data, keep it in JSON.
Errors and how to fix them
JSON root must be an object to convert to TOML.
Your input parsed, but its top level is an array, string, or number. TOML files are key-value documents, so the root has to be an object. Wrap your data in one — { "items": [ … ] } instead of a bare [ … ].
A JSON.parse / "Unexpected token" error
The input isn't valid JSON. The usual culprits are trailing commas (JSON forbids them), single quotes instead of double, unquoted keys, or comments. The status bar points at roughly where the parser stopped.
Some keys disappeared from the output
Those keys held null and Nulls is on Drop. Switch to Empty string to keep them as "", or remove the nulls in your source if you genuinely don't want them.
My dates came out as quoted strings
Expected — JSON stores dates as strings, so the converter has no type information to turn them back into TOML datetimes. Drop the surrounding quotes in the output if you want a native 1979-05-27T07:32:00Z value.
FAQ
Why does TOML have no null?
The spec authors decided a missing value should mean a missing key, not a key set to "nothing". That's why this converter makes you choose — drop the key or empty it — rather than inventing a null literal TOML readers wouldn't accept.
Why dotted headers instead of inline tables?
Dotted table headers ([a.b.c]) read better in a config file than deeply nested inline tables. The Inline ≤ option lets you opt small objects back into inline form when compactness matters more than readability.
Is the round trip lossless?
For any JSON that contains no nulls, JSON → TOML → JSON returns the same data. Nulls are the one thing that can't survive, because TOML can't store them.
Is my data uploaded?
Never. The parse and emit run entirely in your browser. You can go offline after the page loads and the converter still works — safe for files holding API keys or credentials.