Tools

Home
TOML to JSONJSON to YAMLJSON to XMLJSON to CSVJSON Viewer

JSON to TOML Converter

Convert JSON data to TOML format with support for nested objects, arrays, and date detection

Your files never leave your browser
JSON Input0 chars
TOML Output0 chars
Ready·Keys: 0 | Sections: 0 | Arrays: 0

Paste JSON on the left, get valid TOML on the right — nested objects turn into [section] headers, arrays of objects become [[double-bracket]] blocks, and ISO date strings convert to native TOML datetimes automatically. Null values (which TOML doesn't support) get replaced with empty strings and optionally flagged with comments so nothing slips through unnoticed.

And everything runs in your browser. Nothing gets uploaded.

How It Works

Paste JSON
➔
Parse & Map Types
➔
Output TOML

The converter reads your JSON, walks each key-value pair, and decides the right TOML representation. Simple values stay on one line. Objects become [section] headers. Arrays of objects turn into [[array-of-tables]] blocks. ISO 8601 date strings get converted to native TOML datetimes — no quotes needed.

Examples

Basic App Config

A flat JSON object with strings, numbers, and booleans.

INPUT
{ "name": "my-app", "version": "1.3.0", "debug": false, "port": 8080 }
OUTPUT
name = "my-app" version = "1.3.0" debug = false port = 8080

Nested Database Settings

Nested objects become TOML sections with dotted paths. This is where things get interesting.

INPUT
{ "database": { "host": "localhost", "port": 5432, "credentials": { "user": "admin", "password": "s3cret" } } }
OUTPUT
[database] host = "localhost" port = 5432 [database.credentials] user = "admin" password = "s3cret"

Server List with Array of Tables

An array of objects maps to TOML's [[double-bracket]] syntax — one of the trickiest parts to get right by hand.

INPUT
{ "servers": [ {"name": "alpha", "ip": "10.0.0.1"}, {"name": "beta", "ip": "10.0.0.2"} ] }
OUTPUT
[[servers]] name = "alpha" ip = "10.0.0.1" [[servers]] name = "beta" ip = "10.0.0.2"

Who Uses This

👨‍💻 Rust Developers

Converting package configs or API responses into Cargo.toml-compatible format.

⚙️ DevOps Engineers

Migrating service configs from JSON to TOML for tools like Hugo, Netlify, or InfluxDB.

🎓 Students

Learning TOML syntax by seeing how familiar JSON structures translate into a new format.

📊 Data Engineers

Transforming pipeline configs between formats when onboarding new tools or platforms.

Common Mistakes

Passing a JSON array as the top level

TOML requires a table (object) at the root. If your JSON starts with [ instead of {, wrap it: {"items": [...]}.

Expecting null to survive the conversion

TOML has no null type. The converter writes "" instead. Turn on "Comment null conversions" so you can find and fix them in the output.

Mixed arrays confusing the output

TOML arrays must hold one type. If your JSON array mixes strings and numbers like ["a", 1], the output may not parse in strict TOML readers. Clean your data first.

Technical Details

Frequently Asked Questions

Can I convert TOML back to JSON?

Yes. Use the companion TOML to JSON converter on this site. Paste your TOML output there and you will get JSON back. It is a lossless round-trip for most data — the only exception is null values, which become empty strings in TOML and won't revert automatically.

Why does TOML not support null?

Tom Preston-Werner designed TOML to be explicit. If a key has no value, you just leave it out of the file entirely. That is the TOML way of saying "not set." This converter can't delete keys though, so it fills in an empty string and flags it with a comment when that option is on.

What are inline tables in TOML?

Inline tables let you write a small object on one line, like options = { timeout = 30, retries = 3 }. They're handy for tiny objects that don't need their own section header. Enable the "Inline small tables" option to use them in the output.

Does this converter handle deeply nested JSON?

It does. Each nesting level becomes a dotted section path like [a.b.c.d]. There is no depth limit — the converter will walk the entire tree. Really deep nesting can make TOML hard to read though, so consider restructuring if you're past 4-5 levels.

Is the output valid for Cargo.toml or pyproject.toml?

The syntax is valid TOML v1.0, so any compliant parser will read it. But Cargo.toml and pyproject.toml expect specific keys and structure. The converter won't magically know what Cargo needs — you still have to provide the right key names in your input JSON. The format itself will be correct though.

Share: