chain
T
JSON to TOML error
⌃⏎ run · clear · / focus input
// about this tool

JSON to TOML Online

Updated 2026-08-04

// how to use

  1. 1 Paste JSON — an object, not a bare array, since a TOML document is always a table.
  2. 2 The TOML appears as you type, with tables and arrays of tables laid out properly.
  3. 3 Copy it into your Cargo.toml, pyproject.toml or app config.

// examples

An object becomes a table
Input
{ "db": { "port": 8000, "on": true } }
Output
[db]
port = 8000
on = true
An array of objects becomes an array of tables
Input
{ "servers": [ { "name": "alpha" }, { "name": "beta" } ] }
Output
[[servers]]
name = "alpha"

[[servers]]
name = "beta"
A null is refused, not dropped
Input
{ "a": null, "b": 1 }
Output
Error — TOML has no null: the key "a" cannot be represented

// common uses

Turning a JSON config into a Cargo.toml or pyproject.toml section Generating TOML for a tool that only reads TOML, from data you already have as JSON Making a machine-generated config readable for a human Moving settings between two projects that chose different formats

// faq

Why does my JSON with a null fail to convert?
Because TOML has no null. There is no value that means "nothing" — in TOML, absent is how you say null. Rather than quietly dropping the key and handing you a config that is silently missing a field, the tool names the exact key so you can decide whether to remove it or give it a value.
Why can't I convert a top-level array?
A TOML document is a set of key/value pairs, so `[1, 2, 3]` has nowhere to live. Give it a key — `{"items": [1, 2, 3]}` converts to `items = [ 1, 2, 3 ]`. The same applies to a bare string or number at the top level.
How are nested objects laid out?
A nested object becomes a `[table]` header, and an array of objects becomes repeated `[[table]]` headers — the idiomatic TOML forms, not one long line of inline tables. Deeply nested keys become dotted headers like `[tools.inline]`.
Will a round trip give me back the same JSON?
Structure and values survive, but the two formats do not overlap exactly. TOML dates come back as ISO strings in JSON, and JSON nulls cannot make the trip at all. For everything else, converting there and back is lossless.
Does the JSON leave my browser?
No. The conversion is done in JavaScript on your machine, which matters because config files usually contain the secrets you would least like to paste into someone else's server.

Use this via API

Get a free API key →
curl -X POST https://thesnaptools.com/api/v1/tools/json-to-toml \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"json":"{ \"db\": { \"port\": 8000, \"on\": true } }"}'
Esc
↑↓ navigate open Esc close