TOML to JSON Converter

Your data never leaves your browser

Convert TOML to JSON or JSON to TOML. Supports Cargo.toml, pyproject.toml, and Hugo config files.

Input — TOML
Output — JSON
Ctrl+Shift+CCopyCtrl+KClear

Share this tool

Found it useful? Help a fellow developer discover it.

https://developertoolkit.dev/tools/toml-to-json

Converting TOML to JSON: use cases and format differences

TOML has quietly become the default configuration format for a generation of developer tools. Every Rust project has a Cargo.toml. Every modern Python project using Poetry or Hatch has a pyproject.toml. Hugo, the most popular static site generator, uses TOML by default. The appeal is its readability: TOML is more explicit than YAML (no indentation-sensitive parsing) and more human-friendly than JSON (no quotes around every key, comments supported, native date types). This converter handles the two most common conversion needs: extracting configuration values into JSON for processing by other tools, and converting JSON API responses back into TOML configs. Both directions are lossless for all types that both formats support. Datetimes become ISO 8601 strings in JSON since JSON has no native date type, and they convert back to TOML datetime values correctly.

Frequently Asked Questions

What is TOML?

TOML (Tom's Obvious Minimal Language) is a configuration file format designed to be easy to read and write. It uses a simple key-value syntax with support for strings, integers, floats, booleans, datetimes, arrays, and tables (objects). It was created by Tom Preston-Werner, a co-founder of GitHub.

How is TOML different from YAML and JSON?

TOML is more readable than JSON for config files because it does not require quotes around keys and uses human-friendly syntax for sections and arrays. Compared to YAML, TOML has fewer edge cases and surprises. TOML is better suited for configuration files. JSON is better for data interchange. YAML is common in DevOps tooling like Kubernetes and Ansible.

Where is TOML used?

TOML is the configuration format for Rust projects (Cargo.toml), Python projects (pyproject.toml with Poetry or Hatch), the Hugo static site generator, the Zola static site generator, and many CLI tools. It is also the default config format for the uv Python package manager.

Does TOML support dates and datetimes?

Yes. TOML has native date, time, and datetime types. For example: published = 2024-01-15T10:30:00Z. When converting to JSON, these are serialized as ISO 8601 strings since JSON has no native date type.

Why would JSON not convert to TOML?

TOML requires a top-level object (table). If your JSON is an array at the top level, like [1, 2, 3], it cannot be represented as TOML without wrapping it in an object first. Wrap it as {"items": [1, 2, 3]} and the conversion will succeed.

Related Tools