Skip to main content

JSON ↔ TOML Converter

Convert JSON to TOML or TOML back to JSON for config files like Cargo.toml and pyproject.toml. Readable, copyable output generated in your browser.

Input

Stays in your browser

Output

Converted output will appear here.

Shortcuts: Ctrl+Enter run · Ctrl+Shift+C copy result · / search (use ⌘ on Mac)

Next steps

Done here? Use the Send to… menu on the result to carry it on to JSON Parser or JSON ↔ YAML Converter.

Online JSON to TOML Converter

Convert common configuration data between JSON and TOML without uploading it or installing a local package. It is useful when a project moves configuration between JavaScript tooling that prefers JSON and applications that prefer readable TOML.

What this converter does and who uses it

JSON and TOML both describe structured configuration, but TOML favors readable [section] tables over JSON's nested braces. Two concrete uses: a Node.js project moving a config file to a TOML-based tool (like a Rust or Python service) that doesn't read JSON, and a developer who finds a JSON API response easier to review as TOML while writing documentation or a support ticket.

Worked example

Converting {"app": "DevStackKit", "port": 3000, "features": ["json", "toml"]} to TOML produces app = "DevStackKit", port = 3000, and features = ["json", "toml"] on their own lines — strings, numbers, and arrays of primitives all convert directly. A nested object instead becomes a [section] table: {"server": {"host": "localhost"}} converts to a [server] header followed by host = "localhost".

Common mistakes and edge cases

  • An array of objects becomes an array of tables. {"servers": [{"host": "a.example.com"}]} converts to [[servers]] followed by host = "a.example.com", one [[servers]] block per object, and the same text converts back to the original JSON.
  • Going TOML to JSON, a malformed line (missing =, or a value that isn't quoted, a number, true/false, or a bracketed array) shows an explicit "Invalid TOML" error that names the line, rather than silently skipping it or turning it into a wrong value.
  • TOML comments (#) are stripped during TOML to JSON conversion and have no equivalent when converting JSON to TOML, since JSON has no comment syntax to carry one over from.

Frequently asked questions

What TOML features are supported?
The converter supports common TOML tables, arrays of tables ([[name]]), dotted keys, strings, booleans, numbers, arrays, and comments.
Does conversion upload my configuration?
No. Parsing and serialization run entirely in your browser.
Will every JSON structure map perfectly to TOML?
TOML is table-oriented, so deeply mixed JSON arrays and unusual key shapes may need manual adjustment after conversion.
What actually happens if my JSON array contains objects?
Each object in the array converts to an empty string rather than a nested TOML table — for example, [{"host": "a.example.com"}] becomes [""], silently dropping the data. TOML represents that shape as an array of tables ([[section]]), which this converter does not generate; restructure that array as a nested object (a table) instead, or expect to fix the output by hand.
Can I convert a TOML config file to JSON?
Yes. Choose the TOML to JSON direction, paste the file and read the result as a normal JSON object. TOML dates and times become strings in JSON because JSON has no date type, and tables become nested objects. Look at those two cases first when the output is going to be used by another program.

Related tools

More Formatters & Parsers

View all Formatters & Parsers tools →