JSON to TOML Converter

Convert JSON to TOML online - paste JSON and get clean TOML tables instantly.

input.json
output.toml

About JSON to TOML

Convert JSON into TOML, the configuration format used by Cargo, pyproject.toml, Hugo and many other tools.

🛠️
How to use it
  1. Paste a JSON object into the left editor, or upload a .json file.
  2. Click Convert to TOML.
  3. The TOML appears on the right - copy it or download it as output.toml.
  4. If the JSON can't be expressed in TOML you get a message explaining why.
💡
Tips & use cases
  • The top level must be a JSON object. TOML documents are tables of keys, so a bare array or value has nowhere to go - wrap it in an object first.
  • TOML supports # comments, so you can annotate the result after converting.

Convert JSON to TOML Online

Paste JSON and get equivalent TOML: simple values become key = value lines, nested objects become [tables] and arrays of objects become [[arrays of tables]].

🔄

JSON to TOML example

JSON input
{
  "title": "web-app",
  "version": "1.4.0",
  "private": true,
  "replicas": 3,
  "ports": [
    80,
    443
  ],
  "owner": null,
  "database": {
    "host": "db.example.com",
    "port": 5432,
    "pool": {
      "min": 2,
      "max": 10
    }
  },
  "servers": [
    {
      "name": "alpha",
      "ip": "10.0.0.1"
    },
    {
      "name": "beta",
      "ip": "10.0.0.2",
      "role": "backup"
    }
  ]
}
TOML output
title = "web-app"
version = "1.4.0"
private = true
replicas = 3
ports = [80, 443]

[database]
host = "db.example.com"
port = 5432

[database.pool]
min = 2
max = 10

[[servers]]
name = "alpha"
ip = "10.0.0.1"

[[servers]]
name = "beta"
ip = "10.0.0.2"
role = "backup"
📐

How JSON maps to TOML

  • Objects: nested objects become [table] sections, with dotted names such as [database.pool] for deeper levels.
  • Arrays: arrays of objects become [[array of tables]] sections; other arrays stay on one line, like ports = [80, 443].
  • null: TOML has no null, so keys whose value is null are left out. A null inside an array can't be dropped safely and is reported as an error.
  • Order: within each table, simple values are written before sub-tables. TOML requires this, so the key order can differ from your JSON.
📦

Common reasons to convert JSON to TOML

  • Rust projects: Cargo.toml and tool configuration
  • Python packaging with pyproject.toml
  • Static site generators such as Hugo
  • Moving an app's JSON config to a format that allows comments

JSON to TOML FAQ

Why is a key missing from the TOML output?

Its value was null. TOML has no null type, so the usual convention - followed here - is to leave the key out. In the example above, owner is dropped for that reason.

Why does the converter say the root must be an object?

A TOML document is a table of keys. A JSON array or a single value at the top level has no key to live under, so wrap it first, for example {"items": [...]}.

Are date strings converted to TOML dates?

No. JSON has no date type, so a value like "2026-09-25" stays a quoted string. Remove the quotes by hand if you want a native TOML date.

Is my JSON uploaded to a server?

No. The conversion runs entirely in your browser.