JSON → TOML
JSON Input
Loading editor…
TOML Output
Loading editor…

JSON to TOML Converter

Paste any JSON object and get clean, readable TOML output instantly. Nested objects become TOML tables, arrays stay arrays, and all scalar types map correctly.

Real-time
Output updates as you type.
Clean TOML
Nested objects become proper TOML tables.
Download
Save output as a .toml file.
Client-side
No data is uploaded. Everything runs in your browser.

How JSON Maps to TOML

TOML (Tom's Obvious Minimal Language) is a configuration file format designed to be easy to read. It maps cleanly to JSON but uses a different syntax.

Input JSON:

{
  "server": {
    "host": "localhost",
    "port": 8080,
    "debug": true
  },
  "features": ["auth", "logging"],
  "timeout": 30.5
}

Output TOML:

timeout = 30.5
features = [ "auth", "logging" ]

[server]
host = "localhost"
port = 8080
debug = true

Key mappings:

  • JSON top-level scalar values → TOML key = value pairs at the root
  • JSON nested objects → TOML [table] headers
  • JSON arrays → TOML inline arrays [ ]
  • JSON arrays of objects → TOML [[array of tables]]
  • JSON booleans/numbers → TOML native types (no quotes)

When to Use TOML Over JSON

TOML is the configuration format of choice for several major ecosystems. Rust projects use Cargo.toml for package metadata and dependencies. Python packaging uses pyproject.toml (PEP 518). Hugo static site generator uses TOML for its config. Many CLI tools and system daemons prefer TOML for its human readability.

JSON is better for data exchange — APIs, databases, SDKs. TOML is better for configuration files that humans write and maintain. Unlike JSON, TOML supports comments and has a much more readable syntax for nested configuration. Unlike YAML, it has no indentation-sensitivity or implicit type coercion surprises.

TOML Limitations to Know

TOML has one significant constraint: the root must be an object (table), not an array or a scalar. If your JSON is a root-level array like [1, 2, 3], wrap it in an object first: { "items": [1, 2, 3] }.

Arrays of mixed types are not valid in TOML — every element must be the same type. If your JSON array mixes strings and numbers, the converter will error. Clean up the array type before converting.

TOML dates (1979-05-27T07:32:00Z) are a distinct native type. JSON date strings are converted as plain strings — they won't be recognised as TOML datetime values unless the format matches the RFC 3339 spec exactly.

Frequently Asked Questions

Why is my root array not converting?

TOML requires a root object (table). A root-level array has no TOML equivalent. Wrap it in an object first: { "items": [...] }.

How are nested objects handled?

Nested objects become TOML table headers — [section] for single nesting, [parent.child] for deeper nesting. Arrays of objects become [[array of tables]] with double brackets.

Does TOML support comments?

Yes — TOML supports # comments, but they can only be added manually after conversion. JSON has no comment syntax, so there is nothing to carry over from the input.

What is the difference between TOML and YAML?

Both are human-readable config formats. TOML is stricter and simpler — no indentation sensitivity, explicit types, no implicit boolean coercion (yes/no/on/off). YAML is more expressive but has more edge cases. TOML is preferred in the Rust, Python packaging, and Hugo ecosystems; YAML dominates in Kubernetes, GitHub Actions, and Ansible.

Can I convert TOML back to JSON?

Yes — use the TOML to JSON converter to go the other direction.

Is my data uploaded anywhere?

No. Conversion runs in your browser using the @iarna/toml library. Nothing is transmitted.

More Tools