TOML ↔ JSON Converter
Convert TOML to JSON and JSON to TOML. Used for Rust, Hugo, Cargo, and config files.
What is TOML?
Tom's Obvious Minimal Language
TOML is a config file format designed to be easy to read and write. It's the standard for Rust's Cargo.toml, Hugo static site configs, and many modern tools.
Key features
Native date/time types, inline tables, arrays of tables, multi-line strings, and comments — all things JSON doesn't support.
vs YAML and JSON
TOML is more explicit than YAML (no surprising type coercion) and more readable than JSON for config files. It's the config format of choice in the Rust ecosystem.
TOML — The Configuration Format Developers Are Switching To
TOML (Tom's Obvious Minimal Language) was created in 2013 by Tom Preston-Werner, co-founder of GitHub. His frustration with YAML's complexity and JSON's lack of comments led to TOML — a format that reads like an INI file but has a proper specification and supports complex nested data. It has since become the standard for Rust projects (Cargo.toml), Python packaging (pyproject.toml), and Hugo static sites.
What makes TOML different
TOML uses section headers in square brackets to define tables: [database] followed by key-value pairs defines a database configuration object. Arrays of tables use double brackets: [[servers]] defines an array where each [[servers]] block is one element. This is more explicit than YAML's indentation-based nesting and more readable than JSON's braces and quotes.
TOML native types
TOML has native support for types that JSON lacks. Dates: 2023-11-14. Datetimes with timezone: 2023-11-14T22:13:20Z. Local time: 22:13:20. Integers with underscores for readability: 1_000_000. Hexadecimal: 0xFF. These types are preserved during conversion — dates become ISO 8601 strings in the JSON output since JSON has no native date type.
When to use TOML vs YAML vs JSON
Choose TOML for configuration files in Rust, Python, or Hugo projects — it's the ecosystem standard. Choose YAML for Kubernetes, Docker, and GitHub Actions — it's required there. Choose JSON for APIs and data interchange — it's universally supported and fastest to parse. All three represent the same data structures; the choice is about ecosystem conventions and human readability.
Frequently asked questions
2023-11-14T22:13:20Z). Since JSON has no date type, they're converted to ISO 8601 strings in the JSON output.