JSON to TOML and TOML to JSON converter
About JSON ⇄ TOML
The JSON to TOML converter moves config data between strict JSON and readable TOML, in both directions. JSON objects become root keys and named tables. Nested objects become nested tables, and arrays of objects become TOML array tables. The reverse direction gives you formatted JSON for tools that do not read TOML.
Format TOML mode validates a TOML file against the TOML 1.0 grammar and rewrites it with consistent spacing, arrays and table sections. Errors show the line and column, so it doubles as a TOML validator for Cargo.toml, pyproject.toml and other config files.
Runs in your browser. Nothing is uploaded, which matters when a config holds internal hostnames, feature flags or service settings.
The TOML to JSON reader covers what most app configs use: standard and dotted keys, tables, array tables, primitive arrays, inline tables, booleans, numbers, strings and date-like values. Multiline strings and some TOML number spellings are not supported there. It reports them as errors and does not misread them.
How it works
Turn nested objects into TOML tables
Scalar values become key-value pairs. Nested JSON objects get table headers such as [server.database]. Keys that are not valid bare TOML keys are quoted for you.
Represent arrays of objects as array tables
A JSON array of objects is written with repeated [[table]] headers. Arrays of primitives stay inline. So a list of values and a list of records stay distinct.
Parse comments without altering quoted text
In TOML to JSON mode, hash comments are removed only outside quoted strings. Table paths, dotted keys and inline collections are then built into nested JSON.
Handle the JSON null mismatch explicitly
TOML has no null value. When JSON to TOML conversion hits a null, it stops and explains why. It does not invent a string, delete the key or make another lossy change without asking.
Validate and format TOML
Format TOML parses the full TOML 1.0 grammar, including multiline strings, dates and times, dotted keys and arrays of tables. Valid files are rewritten with normalized spacing and table sections. Turn on Sort keys recursively for a stable key order. Large integers keep their exact value, and Write numbers as floats writes numbers in float notation for tools that care about the difference.
Frequently asked questions
Can TOML represent JSON null?
No. TOML has no null type. Remove the field or pick a replacement that makes sense for your app before you convert.
Are TOML comments preserved when converting to JSON?
No. JSON has no comment syntax, so comments are dropped during parsing. Values and hierarchy convert, but comments cannot survive a round trip through JSON.
How do I validate a TOML file?
Pick Format TOML and paste the file. If it is valid you get the formatted version. If not, the error shows the line and column of the first problem.
Does formatting keep my TOML comments?
No. The formatter writes the parsed data, so comments and exact source spelling are lost.
Does the converter support every TOML 1.0 feature?
Format TOML does. TOML to JSON supports tables, array tables, arrays, inline tables and scalar values, but not multiline strings and some special number or date forms.
Why must JSON to TOML input be an object?
A TOML document is a set of keys and tables, so it needs a root object. Wrap a root JSON array or primitive in a named property before you convert it.
Sources & last verified
We checked this tool's behavior and the claims on this page against the specifications below on . The tool runs in your browser, so the output you see is exactly what the engine produced.
Found a wrong result or an outdated claim? Report an error and we will check it again.