JSON to TOML
Convert JSON to TOML live — optional lenient JSON input (comments, trailing commas, single quotes) and key stats.
About this ToolHow it works, benefits & use casesTap to collapse
JSON to TOML converts a JSON object into equivalent TOML, the format used by configuration files like Cargo.toml and pyproject.toml. Paste JSON into the input and the tool parses it and serializes it to TOML using the @iarna/toml library, turning nested objects into [table] headers and arrays of objects into [[array-of-tables]] blocks. Conversion happens live as you type. Because real-world JSON is often hand-edited, there is a "Repair (lenient)" toggle that accepts non-strict input — comments, trailing commas, single-quoted strings, and unquoted keys — and cleans it up before converting. Since TOML requires a top-level table, the tool tells you clearly if your JSON root is an array or a bare value instead of an object. A footer reports the key count and number of output lines, and the result can be copied or downloaded as a .toml file. Everything runs in your browser, free.
How to Use
- 1Paste your JSON into the input panel, or click "Load example" for a sample object.
- 2If your JSON is non-strict (comments, trailing commas, single quotes), enable "Repair (lenient)" in Options.
- 3The TOML output renders live as you type; click "Convert to TOML" to confirm.
- 4If the input is not a top-level object, read the inline message explaining why TOML needs a table at the root.
- 5Copy the TOML or download it as output.toml; the footer shows the key and line counts.
Key Benefits
- Serializes JSON to valid TOML with [table] and [[array-of-tables]] sections
- Lenient mode accepts comments, trailing commas, single quotes, and unquoted keys
- Live conversion updates as you type
- Clear message when the JSON root is an array or value rather than an object
- Key count and output line count reported in the footer
- Copy or download the result as a .toml file
- Runs entirely in the browser with no upload or sign-up
Common Use Cases
- Turning a JSON config blob into a Cargo.toml or pyproject.toml section
- Migrating settings from a JSON-based tool to a TOML-based one
- Generating a TOML fixture from an existing JSON sample
- Cleaning up a hand-edited JSON snippet and converting it in one step via lenient mode
- Comparing how the same configuration looks in JSON versus TOML
Options
Accept comments / trailing commas / single quotes
0 characters · live
Paste JSON above to see the TOML live.
Was this tool helpful?
Share Your Experience
Help others discover this tool!
Related tools
- Railway Config GeneratorBuild railway.json or railway.toml — build/deploy, restart policy, healthcheck, replicas, region, nixpacks — with a format toggle and audit
- Color ConverterConvert between HEX, RGB, HSL, and HSV
- cURL to Code ConverterConvert cURL commands to code in various languages
- JSON Path FinderFind and test JSON paths
- npm to Yarn ConverterConvert npm commands and package-lock.json to Yarn equivalents
- Postman to cURL ConverterConvert Postman requests to cURL commands
TOML documents are always a table (a set of key/value pairs) at the root — they cannot begin with a bare array or scalar. If your JSON is, for example, [1, 2, 3] or "hello", the tool reports this clearly instead of producing invalid TOML. Wrap the value in an object with a key to convert it.
Lenient mode runs your input through a tolerant parser that handles JavaScript-style comments, trailing commas, single-quoted strings, and unquoted object keys before conversion. It is string-aware, so repairs are only applied to syntax outside string literals. This lets you convert JSON-ish snippets that strict JSON.parse would reject.

