JSON to TOML Converter

Paste JSON or XML and turn it into TOML, the config format used by Rust's Cargo, Python's pyproject.toml and many other tools.

Editor (Formatted View)
1
Ready — paste or type JSON / XML here
Viewer
Converted output will appear here
Ready

How to convert JSON to TOML

  1. Paste JSON or XML into the editor. The top level has to be an object, not an array.
  2. Click Format first if you want to check that the input is valid.
  3. Click Convert to TOML. The result appears on the right.
  4. Copy it into your .toml file or download it.

How JSON maps to TOML

JSONTOML
"title": "Demo"title = "Demo"
"ports": [80, 443]ports = [80, 443]
"owner": { … }a [owner] table
"servers": [{ … }, { … }]one [[servers]] block per item
nullleft out, because TOML has no null

Example

{
  "title": "Demo",
  "ports": [80, 443],
  "owner": { "name": "Ada" },
  "servers": [
    { "ip": "10.0.0.1", "role": { "primary": true } },
    { "ip": "10.0.0.2" }
  ]
}

becomes

title = "Demo"
ports = [80, 443]

[owner]
name = "Ada"

[[servers]]
ip = "10.0.0.1"

[servers.role]
primary = true

[[servers]]
ip = "10.0.0.2"

Plain values always come before any table, because in TOML a key belongs to the last table heading above it. Keys with spaces or other special characters are wrapped in quotes, for example "first name" = "Ada".

Where you'll meet TOML

TOML was designed so that one file maps to one clear structure, with none of YAML's indentation surprises. That is why it is popular for configuration that people maintain by hand.

Frequently asked questions

Why is one of my fields missing after conversion?

It was most likely null. TOML has no null value, so those keys are skipped. If the target tool needs the key, give it an empty string or a default value in the source.

Why do I get an error about a top-level array?

A TOML document is always a table of keys, so the input must be a JSON object. Wrap the array in an object, for example {"items": [ … ]}, and it becomes [[items]] blocks.

Can I convert TOML back to JSON?

Not on this page at the moment. The converter works from JSON or XML to TOML.

Other tools

Share Content

Choose what to share and generate an instant link

🔥 One-time link Content deleted from server after first view
✉️
Uploading to server…