consolelog.tools

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 cases

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

  1. 1Paste your JSON into the input panel, or click "Load example" for a sample object.
  2. 2If your JSON is non-strict (comments, trailing commas, single quotes), enable "Repair (lenient)" in Options.
  3. 3The TOML output renders live as you type; click "Convert to TOML" to confirm.
  4. 4If the input is not a top-level object, read the inline message explaining why TOML needs a table at the root.
  5. 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