TXT · Text & Data tools

JSON to TOML Converter

Input · JSON
Output · TOML
0 Bin0 Bout0lines in0keysEmptyJSON
Go to the full Data Format Converter

JSON to TOML

Convert a JSON object to TOML. Paste JSON on the left; the TOML output builds on the right as you type.

{ "package": { "name": "vayce", "version": "1.0" }, "dependencies": ["astro", "preact"] }

becomes

dependencies = [ "astro", "preact" ]

[package]
name = "vayce"
version = "1.0"

A nested object like package becomes a [package] table. A flat array of strings stays an inline array, since TOML supports arrays as values directly, it’s only the root of the whole document that can’t be an array.

The root must be an object

TOML documents are key-value pairs from the first line, so there’s no way to represent a JSON value that’s just [1, 2, 3] or "hello" on its own. If your JSON is a bare array, wrap it in a key first, converting [1, 2, 3] to { "values": [1, 2, 3] }, and the conversion works normally.

Null has no TOML equivalent

Config formats like TOML are built around always-present, typed values, so there’s no null literal. A field with a null value in your JSON is dropped from the TOML output entirely rather than being written as an empty string or a comment. If a downstream tool depends on the key existing, replace null with an empty string, 0, or false before converting, depending on what the field means.

Common use: config files

JSON to TOML shows up most when migrating a Node config to a Rust or Python project, since Cargo and many Python tools read Cargo.toml or pyproject.toml natively. Test the output against your target tool’s schema afterward; TOML’s table syntax accepts several equivalent layouts for the same data, and this converter picks one consistently rather than matching a specific style guide.

Frequently Asked Questions

TOML files are always a set of key-value pairs and tables; there's no syntax for a file that's just an array or a single string. Wrap your JSON value in an object with one key, such as { "items": [...] }, before converting.

They're dropped from the output. TOML has no null or undefined type, so a field with a null value disappears rather than being written as empty. The warning strip notes when this happens.

An array of objects becomes an array of inline tables or a TOML array-of-tables, depending on the shape, so a JSON array like [{ "id": 1 }, { "id": 2 }] keeps its structure rather than flattening.

TOML preserves the key order from your JSON object, which mostly matters for readability since parsers read keys by name, not position.

Yes. A nested object becomes a TOML table, written with a [table.name] header or as an inline table, depending on how deeply it's nested.

Jump straight to a conversion

Full Data Format Converter tool

Explore Our Tools

Browse all tools