TOML ↔ JSON Converter
Convert between TOML and JSON formats instantly with real-time validation and formatting options.
About This Tool
The TOML to JSON Converter is a free, browser-based utility that
transforms data between TOML and JSON formats in real time. Whether
you are working with a Rust project's Cargo.toml,
a Python project's pyproject.toml, or any other
TOML-based configuration, this tool lets you quickly convert to JSON
for further processing, API consumption, or interoperability with
tools that only accept JSON.
TOML (Tom's Obvious Minimal Language) is a configuration file
format designed to be easy to read and write thanks to its clean,
minimal syntax. It supports rich data types including strings,
integers, floats, booleans, dates, arrays, and nested tables.
TOML has become the standard configuration format for the Rust
ecosystem (Cargo.toml), Python packaging (
pyproject.toml as defined by PEP 518 and PEP 621),
and a growing number of tools like Hugo, Deno, and Starship prompt.
JSON (JavaScript Object Notation) remains the most widely used data interchange format on the web. While JSON is universally supported by programming languages, APIs, and tooling, it lacks comments and can be verbose for configuration purposes. Converting TOML to JSON bridges the gap between a human-friendly config format and the machine-friendly format expected by many tools and services.
All conversion happens entirely in your browser using the
smol-toml library for TOML parsing and serialization,
and native JSON.parse / JSON.stringify
for JSON handling. Your data never leaves your machine —
there are no server round-trips, no logging, and no third-party
services involved. This makes it safe to convert configuration
files that contain database credentials, API keys, or other
sensitive values.
The tool offers configurable JSON indentation (2 or 4 spaces), an auto-convert toggle for real-time feedback, and a direction swap button that moves the output back into the input for easy round-trip conversions. Error messages include details about what went wrong and where, so you can quickly locate and fix syntax issues in your TOML or JSON input.
How to Use
- Select the conversion direction using the TOML → JSON or JSON → TOML toggle button at the top.
- Paste or type your data into the Input panel on the left. Alternatively, click Sample to load an example
Cargo.toml-style configuration. - With auto-convert enabled, the converted output appears instantly in the Output panel on the right. If auto-convert is off, click Convert or press Ctrl+Enter to trigger conversion.
- Choose your preferred JSON indentation (2 or 4 spaces) from the options bar.
- Click Copy to copy the output, or use the keyboard shortcut Ctrl+Shift+C .
- Use the Swap button to reverse the direction and move the current output into the input, letting you round-trip conversions easily.
- Click Clear to reset both panels.
Popular TOML ↔ JSON Examples
FAQ
Is my data sent to a server?
No. All conversion is performed entirely in your browser using the smol-toml library and native JSON APIs. Your data never leaves your machine. There are no network requests, no logging, and no analytics on your input.
What is TOML and where is it used?
TOML (Tom's Obvious Minimal Language) is a configuration file format that aims to be easy to read due to its clear semantics. It is the standard format for Rust's Cargo.toml, Python's pyproject.toml, Hugo site configuration, Deno configuration, and many other development tools.
What is the difference between TOML and JSON?
TOML supports comments, has distinct date/time types, uses a table-based syntax with [section] headers, and is designed for human readability. JSON uses braces and brackets, has no comment support, and is optimized for machine parsing and data interchange. Both represent key-value data but serve different primary use cases.
Can I convert JSON with arrays at the root level to TOML?
No. The TOML specification requires the root of a document to be a table (equivalent to a JSON object). If your JSON has an array or primitive value at the root level, an error will be shown explaining this limitation. Wrap your data in an object to convert it successfully.
Does the tool handle TOML date/time values?
Yes. The smol-toml parser supports TOML date, time, and datetime types. When converting to JSON these are serialized as strings, since JSON does not have native date types. When converting back from JSON to TOML, date-like strings remain as regular strings.
What happens with invalid input?
An error message is displayed with the parser's description of the problem, including position information when available. This helps you quickly locate and fix syntax issues in your TOML or JSON input.
What keyboard shortcuts are available?
Press Ctrl+Enter to trigger conversion (when auto-convert is off) and Ctrl+Shift+C to copy the converted output to your clipboard.
Related Tools
JSON ↔ YAML Converter
Convert between JSON and YAML formats instantly with syntax validation.
JSON Formatter
Format, validate, and beautify JSON with syntax highlighting and tree view.
YAML Formatter
Format, validate, and minify YAML with customizable indentation and syntax error display.
JSON ↔ XML Converter
Convert between JSON and XML formats instantly with customizable root element and attribute handling.
Plist ↔ JSON Converter
Convert between Apple Property List (plist) XML and JSON formats with type detection and tree view.
HCL ↔ JSON Converter
Convert between Terraform HCL and JSON formats with syntax highlighting and tree view.
INI ↔ JSON Converter
Convert between INI configuration files and JSON format with section handling, comment preservation, and type coercion.
Properties ↔ JSON Converter
Convert Java .properties files to JSON and back. Supports dot-notation expansion, Unicode escapes, multi-line values, and comments.
requirements.txt ↔ pyproject.toml
Convert between Python requirements.txt and pyproject.toml dependency formats with support for version specifiers, extras, and environment markers.