Code Tools

Home
JSON to YAMLYAML to JSONJSON to CSVCSV to JSONXML to JSONJSON to XML

TOML to JSON Converter

Paste TOML markup and instantly convert it to formatted JSON -- 100% client-side

Your files never leave your browser
TOML0 chars, 0 lines
1
JSON0 chars
Ready·
Need further conversion? Try JSON to YAML next.

Paste any TOML — Cargo.toml, pyproject.toml, Hugo configs — and get clean, valid JSON back in one click. Handles nested tables, arrays of tables, dotted keys, inline tables, and datetime types with line-level error reporting when something's off. And everything runs in your browser. Nothing gets uploaded.

How It Works

Paste TOML
→
Parse & Validate
→
JSON Output

The parser reads your TOML token by token, builds a nested object tree, then serializes it to JSON. Tables become objects, arrays of tables become JSON arrays, and TOML dates get converted to ISO strings. If something doesn't parse, you'll see the error with a line number — no vague "invalid input" messages.

Examples

Basic Package Config

A typical pyproject.toml snippet you'd feed into a build script that only reads JSON.

INPUT
[project] name = "my-app" version = "2.1.0" authors = ["Alice", "Bob"]
OUTPUT
{ "project": { "name": "my-app", "version": "2.1.0", "authors": ["Alice", "Bob"] } }

Nested Tables with Dotted Keys

TOML's dotted key syntax is compact but trips people up when they try to picture the JSON structure. This clears it up.

INPUT
[database] server = "192.168.1.1" ports = [8001, 8001, 8002] connection_max = 5000 enabled = true [database.credentials] user = "admin" pass = "s3cret"
OUTPUT
{ "database": { "server": "192.168.1.1", "ports": [8001, 8001, 8002], "connection_max": 5000, "enabled": true, "credentials": { "user": "admin", "pass": "s3cret" } } }

Array of Tables (Multiple Servers)

The double-bracket [[servers]] syntax creates an array of objects — probably the trickiest TOML feature to convert by hand.

INPUT
[[servers]] name = "alpha" ip = "10.0.0.1" [[servers]] name = "beta" ip = "10.0.0.2"
OUTPUT
{ "servers": [ { "name": "alpha", "ip": "10.0.0.1" }, { "name": "beta", "ip": "10.0.0.2" } ] }

Who Uses This

🦀 Rust Developers

Convert Cargo.toml settings to JSON for CI pipelines and build tooling that can't read TOML natively.

🐍 Python Developers

Turn pyproject.toml metadata into JSON for scripts, package registries, or API payloads.

⚙️ DevOps Engineers

Translate TOML configs into JSON for tools like Terraform, Ansible, or custom deployment scripts.

📝 Technical Writers

Grab JSON versions of config examples for documentation that needs to show both formats side by side.

Common Mistakes

Mixing tabs and spaces for indentation

TOML only allows spaces, not tabs. If you copied from an editor with tab indentation, you'll get a parse error. Switch your editor to spaces-only before pasting.

Redefining the same table header twice

Writing [database] on two separate lines is illegal in TOML — you can't reopen a standard table. Group all keys under one header, or use dotted keys like database.timeout = 30 elsewhere.

Confusing [[array]] with [table] syntax

Single brackets define a table (object). Double brackets define an array of tables. Using [servers] twice is an error; [[servers]] twice creates two entries in an array. Big difference.

Bare keys with special characters

Bare keys in TOML can only contain letters, digits, dashes, and underscores. A key like my.key without quotes creates a nested table, not a key with a dot. Wrap it in quotes: "my.key" = "value".

Technical Details

Frequently Asked Questions

What is TOML and how is it different from JSON?

TOML stands for Tom's Obvious Minimal Language. It was designed specifically for config files — think Cargo.toml or pyproject.toml. Unlike JSON, TOML supports comments, doesn't need quotes around every key, and has a cleaner syntax for nested structures. JSON is more universal for APIs and data exchange, though, which is why you'd want to convert between them.

Does the converter preserve TOML comments in the JSON output?

No. JSON doesn't support comments at all, so any TOML comments (lines starting with #) are stripped during conversion. If you need to keep those notes, copy them somewhere before converting.

How are TOML dates and times handled in JSON?

TOML has native date, time, and datetime types. Since JSON has no date type, these get converted to ISO 8601 strings. A TOML value like created = 2024-01-15T09:30:00Z becomes "created": "2024-01-15T09:30:00Z" in JSON. The data is the same — just wrapped in quotes.

Can I convert large TOML files?

Yes. Since everything runs locally in your browser, the only limit is your device's memory. Files over 500 KB convert fine on most machines. For extremely large files (several MB), you might notice a brief pause, but it'll still work.

Is there a way to convert JSON back to TOML?

Not with this specific tool — it's one-directional. TOML has structural rules that make reverse conversion tricky (like deciding when to use tables vs inline tables). You can hit the Swap button to move output back to the input panel, but for a proper JSON-to-TOML conversion, you'd need a dedicated converter.

Share: