Command Palette

Search for a command to run...

JS

JSON to TOML Converter

Convert JSON to TOML 1.0. Objects become tables, arrays of objects become arrays of tables, and everything is rendered inline where TOML expects it.

Category:data
Mode:Offline
Version:1.0.0
Access:Free

What is the JSON to TOML Converter?

The JSON to TOML Converter turns a JSON document into a TOML 1.0.0 configuration file. You paste JSON on the left, and the tool emits TOML that re-parses to the same data: top-level JSON objects become the root table, nested objects become `[table]` headers, arrays of objects become `[[array-of-tables]]` blocks, and scalars, mixed arrays, and small objects are written inline. It is the fastest way to move a config out of an API response or a JSON settings file and into the TOML that tools like Cargo, Poetry, Hugo, and many Rust and Go projects expect.

TOML (Tom's Obvious, Minimal Language) reads like an INI file but has a precise specification: typed values, first-class dates, and two distinct ways to express nested data. That precision is exactly what trips people up when hand-editing. The rule that catches everyone is ordering, a table's own keys must appear before any of its sub-table headers, or the file fails to parse. This converter applies that rule automatically, so you never end up with a key stranded under the wrong header.

Everything runs in your browser as plain JavaScript. The JSON you paste is never uploaded, there is no account to create, and the converter keeps working with no network connection once the page has loaded. That matters when the JSON is a production config or contains secrets you would rather not send to a third-party server. The output is standard TOML you can copy straight into `Cargo.toml`, `pyproject.toml`, `config.toml`, or any other TOML file.

A few conversions have no single right answer, and the tool makes its choices explicit. JSON `null` has no TOML equivalent, so null keys are dropped by default (with a note) or written as an empty string if you prefer. A JSON number like `5.0` arrives as the integer `5` because JSON does not preserve the trailing zero. And an array of objects can be written either as idiomatic arrays of tables or as inline tables, which you toggle depending on how the target tool likes to read its config.

How to use the JSON to TOML Converter?

1

Paste your JSON

Paste or type a JSON object into the input box, or click Load Sample to see a worked example. The top level must be a JSON object, since a TOML document is always a table.

2

Choose how arrays and nulls are handled

Toggle whether arrays of objects become arrays of tables ([[table]]) or inline tables, and whether JSON null keys are dropped or written as empty strings.

3

Convert

Click Convert. The tool validates the JSON, serialises it to TOML 1.0, and reports the number of tables written plus any notes about dropped nulls.

4

Copy the TOML

Copy the result and paste it into your Cargo.toml, pyproject.toml, or config.toml. The output is standard TOML that re-parses to the same data.

Key Features

Correct Table Ordering

Keys are emitted before sub-table headers automatically, so the output obeys the TOML rule that would otherwise make a hand-written file fail to parse

Arrays of Tables

Arrays whose elements are all objects become idiomatic [[table]] blocks, the TOML pattern for lists of records, or inline tables when you prefer them

Proper Value Typing

Integers, floats, booleans, and strings are rendered with TOML types, including inf and nan for non-finite numbers and full escaping of control characters in strings

Explicit Null Handling

JSON null has no TOML equivalent, so you choose whether null keys are dropped with a note or written as empty strings, no silent data loss

Frequently Asked Questions

Paste your JSON object into the converter and click Convert. The tool serialises objects to TOML tables, arrays of objects to arrays of tables, and every other value inline, then gives you standard TOML to copy. The top-level JSON must be an object, because a TOML document is always a table.

Comments

0 comments

0/2000 characters

No comments yet. Be the first to share your thoughts!

json to tomljson to toml converterconvert json to tomltoml generatorjson tomltoml config generatorjson to toml onlinedata format convertercargo toml converter