EUComply

How to Convert JSON to TOML

August 24, 2026 · 4 min read · Try the free converter →

You're adopting Rust or Python packaging conventions and want your config in Cargo.toml/pyproject.toml style — but your data starts life as JSON from an API or an export. Here's how to convert it cleanly.

Method 1: CLI

Using transmute

$ cat config.json | transmute --to toml
name = "my-app"
version = "2.0"
retries = 3

The format is auto-detected on input, so there are no flags to argue with. Nested objects become TOML sections ([server.tls]), scalars keep their types, and strings are escaped per the TOML spec.

Using dasel

$ dasel convert -r json -w toml < config.json

dasel handles many formats both ways. It's a solid alternative if you already have Go installed; otherwise a single static binary like Transmute is quicker to set up.

Method 2: Python

import json, tomli_w
data = json.load(open("config.json"))
with open("config.toml", "wb") as f:
    tomli_w.dump(data, f)

tomli_w writes TOML fast and correctly. One caveat: Python dicts must be converted to TOML-compatible types first — tuples work as arrays, sets don't.

Gotchas: JSON and TOML Are Not Equivalent

Convert JSON → TOML in one click

Transmute runs the conversion on your machine — paste it in, or script it from the command line. JSON, YAML, CSV, TOML and XML, fully offline.

Get Transmute Desktop — $19 one-time →   Or use the free web converter