Converters
JSON to TOML Converter
Turn a JSON object into well-formed TOML — tables from nested objects, [[tables]] from arrays of objects, and an honest report of what a null cost you.
In short
Convert JSON to TOML online: objects become tables, arrays of objects become [[tables]], nulls are dropped with a report, keys quoted where TOML needs it. Client-side.
By NaveenKumar T · Updated
Learn: TOML vs YAML vs JSON: Choosing a Configuration Format
- Objects → [tables], object arrays → [[tables]]
- Null handling you choose (omit or fail)
- Integer or always-float numbers
Runs entirely in your browser — nothing you paste or open here is uploaded, logged, or stored.How we handle data →
Example
JSON to TOML: input and output
A package.json-shaped object: nested scripts, an array of plain strings, an array of contributor objects, a null license, and two numbers that look similar but should convert differently.
{
"name": "shopfront",
"version": "1.0",
"license": null,
"minNode": 18.0,
"scripts": {
"build": "next build",
"test": "vitest run"
},
"keywords": ["shop", "storefront", "next"],
"contributors": [
{ "name": "Ada Lovelace", "email": "ada@example.com" },
{ "name": "Grace Hopper", "email": "grace@example.com" }
]
}name = "shopfront"
version = "1.0"
minNode = 18
keywords = [ "shop", "storefront", "next" ]
[scripts]
build = "next build"
test = "vitest run"
[[contributors]]
name = "Ada Lovelace"
email = "ada@example.com"
[[contributors]]
name = "Grace Hopper"
email = "grace@example.com"
contributors became two [[contributors]] tables while keywords stayed a plain inline array of strings; license was dropped entirely with the omission counted in the status message; and "1.0" (a JSON string) came out as the literal text 1.0 while minNode's 18.0 collapsed to the integer 18, because JSON.parse had already erased the distinction between 18.0 and 18 before this converter ever saw the value.
Learn more
How JSON values become TOML
The conversion walks the parsed JSON tree and picks the TOML construct each shape maps onto most naturally: a JSON object becomes a TOML table (top-level keys become the implicit root table; nested objects become [headings] or inline tables depending on size), a JSON array of plain objects becomes an [[array of tables]], and every other JSON array — of strings, numbers, booleans, or a mix — becomes an ordinary TOML inline array. Strings, numbers and booleans map onto their obvious TOML equivalents; only null and a bare top-level array have no direct TOML representation, and both are handled explicitly rather than silently mangled (see the FAQ above).
Object keys are quoted automatically wherever TOML's bare-key grammar would reject them unquoted — a key containing a space, a dot, or most punctuation becomes a quoted TOML key like "content-type" rather than being merged into the wrong table or rejected outright.
| JSON | TOML |
|---|---|
| Object | Table (or inline table when nested) |
| Array of plain objects | [[array of tables]] |
| Array of scalars, or mixed | Inline array [ … ] |
| String | Basic string "…" |
| Number (no fraction) | Integer (or float, with the Numbers option) |
| Number (with a fraction) | Float |
| Boolean | true / false |
| null (object value) | Key omitted, or a conversion error — your choice |
| null (array element) | Always an error — TOML arrays cannot hold null |
Using the output in pyproject.toml, Cargo.toml, wrangler.toml
Each TOML-consuming ecosystem expects its own top-level shape, so treat this converter's output as a correct STARTING structure rather than a drop-in replacement for a whole file: a JSON object describing Python project metadata converts cleanly into the [project] table pyproject.toml expects (PEP 518/621), a JSON description of crate metadata becomes the [package] and [dependencies] tables Cargo.toml wants, and a JSON object of bindings and routes converts into the tables wrangler.toml's schema defines. In every case, paste the converted TOML under the right top-level heading in the real file rather than replacing the whole document, since these formats also carry tool-specific keys and ordering conventions this converter has no way to know about.
After converting, run the result through TOML Formatter in Validate mode to confirm it parses cleanly, or use JSON Formatter on the ORIGINAL JSON first if you're not sure it's well-formed. The TOML vs YAML vs JSON guide covers which ecosystems standardized on which format and why, and TOML to JSON is the reverse direction for round-tripping.
Help
Frequently asked questions
Everything you need to know about the JSON to TOML.
01How do I convert JSON to TOML?
Paste a JSON object (not an array — see the next question) and press Convert. Nested objects become TOML tables, arrays of objects become [[array-of-tables]] blocks, and the output is ready to save as a .toml file. A malformed document is rejected with the same line/column error the JSON Formatter would give you.
02Why can't I convert a top-level JSON array?
Because a TOML document is, structurally, a table — every valid .toml file's root is a set of key = value pairs and [headings], with nowhere to put a bare list of values that isn't attached to a key. If your data is fundamentally an array — a list of users, a list of products — wrap it in an object first: {"items": [...]}. items then becomes an [[items]] array-of-tables block if the elements are objects, or a plain items = [...] array if they're scalars.
03What happens to null?
TOML has no null value at all — every key that exists must have a real value — so by default this converter omits any object key whose value is null and reports how many it dropped in the status message, which is the closest honest equivalent to "this field has no value." Switch the Nulls option to "Fail on null" if you'd rather catch a null early and fix the source data than have it silently vanish. Inside an ARRAY, though, there's no way to skip an element without changing every other element's position, so a null inside an array always fails, in either mode, naming the exact index.
04When does an array become [[table]] rather than [ … ]?
Only when every single element of the array is a plain object (not an array, not a scalar) — then the array becomes an [[array-of-tables]] block, one [[name]] heading per element, which is far more readable than a giant inline array once the objects have more than a couple of fields. An array of scalars ([1, 2, 3]) or a MIXED array (some objects, some not) stays an ordinary inline TOML array instead — TOML 1.0 permits mixed-type arrays, so nothing is lost, it just isn't rendered as a sequence of tables.
05Why did 1.0 become 1, and how do I force floats?
JSON.parse has already turned "1.0" written as a JSON number literal into the plain JavaScript number 1 by the time this converter sees it — JSON numbers carry no persistent int-vs-float distinction the way TOML's own grammar does, so information about the original literal's formatting is gone before conversion even starts. By default the converter writes whichever TOML representation is shortest and correct (an integer if the value has no fractional part). Switch the Numbers option to "Always write floats" and every number is written with an explicit decimal point instead — 18 becomes 18.0 — which matters for TOML consumers whose schema expects a float type even when the sample value happens to be a whole number.
Keep working
Related tools
TOML to JSON
Converters
TOML Formatter
Validate TOML with exact error positions and your comments intact, or normalize it into a canonical layout — the two are deliberately different modes.
JSON to YAML
Converters
JSON Formatter
Format, beautify, and validate JSON instantly in a professional VS Code-style editor — free, fast, and 100% private.
JSON to XML
Converters
vCard to JSON Converter
Converters