TOML ↔ JSON Converter
Convert TOML to JSON and JSON to TOML in either direction
TOML Input
JSON Output
About
Convert between TOML and JSON in either direction. Pick a direction, paste your document, and convert. Useful for moving config between Rust/Python tooling (TOML) and the broader JSON ecosystem. Everything runs in your browser; nothing is uploaded.
Examples
TOML to JSON
title = "Example Config"
[database]
host = "localhost"
port = 5432
tags = ["dev", "staging"]{
"title": "Example Config",
"database": {
"host": "localhost",
"port": 5432,
"tags": ["dev", "staging"]
}
}TOML tables ([database]) become nested JSON objects; arrays are preserved as arrays.
JSON to TOML
{
"title": "My Config",
"servers": {
"alpha": { "ip": "10.0.0.1", "dc": "us-east" },
"beta": { "ip": "10.0.0.2", "dc": "us-west" }
}
}title = "My Config"
[servers.alpha]
ip = "10.0.0.1"
dc = "us-east"
[servers.beta]
ip = "10.0.0.2"
dc = "us-west"Nested JSON objects become TOML tables; top-level keys become TOML top-level entries.
About this tool
TOML and JSON are both structured data formats, but they serve different roles. TOML is designed for human-authored configuration files, while JSON is the lingua franca of APIs. Converting between the two is a common step when bridging a TOML config into a JSON-based tool, or when exporting structured TOML data into a web application.
This converter handles both directions using the @iarna/toml library. TOML tables become nested JSON objects, arrays stay arrays, and inline tables are expanded to their full form. Converting JSON back to TOML requires the root to be an object — arrays at the root level have no TOML equivalent and are rejected.
How to use
Choose a direction
Pick TOML → JSON or JSON → TOML. The editor and output panels update to reflect the chosen mode.
Paste your input
Drop a valid TOML or JSON document into the input panel. For TOML → JSON, first row = headers by default; for JSON → TOML, the root must be an object.
Copy the result
Click Copy to grab the converted output, or Download to save it as a file.
Use cases
Bridging TOML config into a JSON API
Convert a Cargo.toml or pyproject.toml into JSON so a build script or CI pipeline can consume the data as structured JSON.
Exporting TOML data to a web app
Convert TOML config to JSON for consumption by a JavaScript or Node.js tool that only speaks JSON.
Inspecting nested TOML as JSON
Convert TOML to JSON to visualize the data model in a way that is familiar to developers who work with JSON daily.
Common mistakes
Mistake:Trying to convert a JSON array at the root level to TOML.
Fix:TOML does not support arrays at the root level — only tables. Wrap the array in an object like { items: [...] } before converting.
Mistake:Losing key order on round-trip.
Fix:JSON objects have no guaranteed key order. TOML preserves the order of keys as written, but round-tripping through JSON may reorder them.
Mistake:Expecting inline tables to expand in JSON→TOML.
Fix:Inline tables in JSON stay inline in TOML (a = { b = 1 }); only regular nested objects expand to TOML table form.
Frequently asked questions
Related guides
TOML vs YAML vs JSON: Choosing the Right Config Format
Why Rust and Python both settled on TOML, what each format actually gives you, and how to validate your Cargo.toml without guessing.
Moving Configuration Between TOML, JSON and YAML: What Survives the Trip
Converting config formats sounds trivial until your dates vanish, your comments disappear, and your multiline string gets folded into one line.
References & standards
Related tools
TOML Validator
Validate TOML and re-emit it as clean, indented JSON
JSON Lines Converter
Convert JSON Lines (NDJSON) to a JSON array and back
CSV to SQL Converter
Generate SQL INSERT statements from CSV data
JSON Schema Validator
Validate a JSON document against a JSON Schema
CSV to Markdown Converter
Convert CSV to a Markdown table and Markdown tables back to CSV
Find and Replace Text
Find and replace text with optional regex, case, and multiline matching