Konverter
JSON ↔ TOML
The JSON ↔ TOML Converter translates between JSON (JavaScript Object Notation) and TOML (Tom's Obvious Minimal Language) in both directions. TOML is the configuration language of choice for many modern tools like Cargo (Rust), Hugo, and Pyproject.toml. Being able to convert from JSON to TOML speeds up migrating configuration formats and helps developers understand how nested structures map between the two formats.
What is TOML?
TOML (Tom's Obvious Minimal Language) is a configuration file format designed to be easy to read and write by humans while mapping unambiguously to a hash table. It was created by Tom Preston-Werner (co-founder of GitHub) as an alternative to YAML and INI files. TOML supports string, integer, float, boolean, datetime, array, and inline table types with explicit type syntax. Tables (objects) are expressed with [section] headers, and nested structures use dotted keys or [[array of tables]] syntax. TOML is the standard configuration format for Rust projects (Cargo.toml) and is increasingly popular in the Python ecosystem (pyproject.toml).
How does the converter work?
For JSON-to-TOML, the tool parses the JSON into an object tree and maps each data type to its TOML equivalent: JSON strings become TOML strings, numbers become integers or floats, booleans map directly, and arrays of objects become TOML array-of-tables ([[table]]). Nested JSON objects become TOML dotted-key sections or [table] headers. For TOML-to-JSON, the tool uses a TOML parser to build the data tree and then serializes it as JSON, preserving all types. TOML datetimes are converted to ISO 8601 strings in JSON output.
Typical Use Cases
- Migrating a JSON configuration file to TOML for a Rust project (Cargo.toml)
- Converting a TOML config to JSON to process it with JSON tooling or APIs
- Understanding how a complex nested JSON structure maps to TOML sections
- Generating TOML from a JSON API response to seed a configuration template
Step-by-step Guide
- Step 1: Paste your JSON or TOML content into the input field.
- Step 2: Select the conversion direction: JSON → TOML or TOML → JSON.
- Step 3: The converted output appears instantly in the result area.
- Step 4: Copy or download the output for use in your project.
Example
Input
{"database":{"host":"localhost","port":5432}}
Output
[database] host = "localhost" port = 5432
Tips & Notes
- TOML has explicit datetime support; ISO 8601 strings in JSON that look like datetimes will be output as TOML datetime literals.
- Arrays of mixed types are valid in JSON but not in TOML – ensure your JSON arrays contain elements of the same type before converting.
- Use the TOML ↔ YAML converter (toml-yaml) if you also work with YAML-based config files.
Frequently Asked Questions
Does TOML support null values?
No. TOML does not have a null type. JSON null values cannot be represented in TOML; the converter will skip null fields or raise a warning.
What happens to JSON arrays of objects?
Arrays of objects in JSON become TOML array-of-tables using the [[table_name]] syntax, which is idiomatic TOML for homogeneous arrays of structured records.
Why is TOML preferred over JSON for configuration files?
TOML supports comments, has a more human-friendly syntax for nested structures, and provides explicit types for dates and times. JSON is more universal as a data exchange format but lacks comments and is verbose for configuration.
JSON ↔ TOML
Convert JSON to TOML and TOML to JSON — live, bidirectional, and with syntax validation.
Open Tool