json:yaml

JSON to TOML converter

Nested objects become [table] headers and arrays of objects become [[array of tables]]. Simple values are written first at each level, as TOML requires.

JSON
TOML

      
Paste JSON to convert.

Conversion happens in this browser tab. Nothing is uploaded, logged, or stored.

The mapping

TOML is designed for configuration files that people edit by hand, and its structure is flatter than JSON's on purpose. Nested objects become [table] headers with dotted paths; arrays of objects become [[array of tables]].

JSON
{
  "name": "checkout-api",
  "replicas": 3,
  "resources": {
    "cpu": "500m"
  }
}
TOML
name = "checkout-api"
replicas = 3

[resources]
cpu = "500m"

Note the ordering rule: every top-level key must appear before the first table header, because everything after a header belongs to that table. The converter handles this automatically, writing simple values first at each level.

What TOML cannot represent

  • A non-object root. TOML documents are always tables. A JSON document that is an array or a bare scalar has no valid TOML equivalent, and the converter will tell you so rather than guess at a wrapper key.
  • Null. TOML has no null. There is no agreed convention for it — the options are an empty string, omitting the key, or a sentinel value, and each breaks something different. Decide before converting.
  • Mixed-type arrays. TOML 1.0 permits them, but many parsers still enforce the older homogeneous-array rule. [1, "two", true] is a compatibility risk.
  • Deeply nested arrays of arrays of tables. Legal, but the resulting headers are long enough to defeat the readability that TOML exists for.

When TOML is the right target

TOML is the config format for Rust's Cargo.toml, Python packaging's pyproject.toml, and Hugo. If you are generating a file for one of those tools, this is the conversion you want.

To read one of those files back into a script, use TOML to JSON. For deeper configuration trees, converting to YAML instead handles nesting far better than TOML does.

It is a poor target for data interchange. Its strengths — comments, obvious types, minimal punctuation — are all about human editing. For machine-to-machine payloads, JSON remains simpler and universally supported.

Nothing is transmitted

TOML output is usually destined for a pyproject.toml or a Cargo.toml — files that sit next to publish tokens and registry credentials, and that occasionally contain them outright.

The conversion is local. Your document is parsed and re-serialised in this browser tab, and no part of it is sent to us. There is no account, no history, and nothing stored between visits.

Questions people ask

Why does my top-level array fail to convert?
TOML documents are always tables. A JSON document whose root is an array or a bare scalar has no valid TOML equivalent, so you get an error rather than an invented wrapper key.
What happens to null values?
TOML has no null. There is no agreed convention for representing one, so decide before converting — omit the key, use an empty string, or use a sentinel value.
When should I use TOML instead of YAML?
When the target tool expects it: Cargo.toml, pyproject.toml, and Hugo. TOML is flatter and less error-prone than YAML for shallow config, but awkward for deeply nested data.
Are mixed-type arrays supported?
TOML 1.0 allows them, but many parsers still enforce the older homogeneous rule. An array like [1, "two", true] is a compatibility risk.