Konverter
TOML ↔ JSON
The TOML to JSON Converter transforms TOML (Tom's Obvious Minimal Language) configuration files into JSON. This is useful when you need to process a TOML config file with JSON-based tooling, pass configuration data to an API, or inspect how TOML types map to JSON. For the reverse direction, use the JSON to TOML converter (json-toml).
What is TOML and when would I convert it to JSON?
TOML is a minimal, human-readable configuration file format with strong typing and support for comments. It is the standard for Rust's Cargo.toml, Python's pyproject.toml, Hugo's configuration, and many other modern tools. JSON is the universal data interchange format supported by virtually every programming language, API, and tool. Converting TOML to JSON is useful when you want to read a TOML config programmatically with a JSON library, pass config values to a REST API, or use jq to query the configuration data. JSON is also easier to validate with JSON Schema.
How does the converter work?
The tool uses a spec-compliant TOML parser to load the input into an in-memory data tree. TOML's native types map to JSON as follows: TOML strings → JSON strings, integers → JSON numbers, floats → JSON numbers, booleans → JSON booleans, datetime → JSON strings in ISO 8601 format, arrays → JSON arrays, inline tables and tables → JSON objects, array of tables → JSON arrays of objects. The resulting tree is serialized as pretty-printed JSON. TOML comments are discarded since JSON has no comment syntax.
Typical Use Cases
- Reading and querying a Cargo.toml or pyproject.toml with jq for CI/CD scripting
- Passing TOML-sourced configuration values to a REST API that only accepts JSON
- Validating a TOML config structure using a JSON Schema validator after conversion
- Migrating a project from TOML configuration to a JSON-based tool
Step-by-step Guide
- Step 1: Paste your TOML content into the input field.
- Step 2: The tool parses the TOML and outputs formatted JSON instantly.
- Step 3: Review the JSON output to verify the type mapping is correct.
- Step 4: Copy or download the JSON output.
Example
Input
[package] name = "my-app" version = "1.0.0"
Output
{
"package": {
"name": "my-app",
"version": "1.0.0"
}
}
Tips & Notes
- TOML datetimes (e.g. 1979-05-27T07:32:00Z) become ISO 8601 strings in JSON – verify downstream consumers handle them as strings.
- TOML comments are not preserved in JSON output because JSON has no comment syntax.
- To convert in the opposite direction, use the JSON to TOML tool (json-toml).
Frequently Asked Questions
Are TOML datetime values preserved?
Yes, but as ISO 8601 strings in JSON, since JSON has no native datetime type. The string representation is fully round-trippable back to a TOML datetime.
Can I convert multiple TOML files at once?
The tool processes one TOML document at a time. For batch conversion, use a command-line tool like 'tomljson' or write a small script using a TOML library in your preferred language.
Why are TOML comments not in the JSON output?
Standard JSON does not support comments. If you need to preserve comments for documentation purposes, consider converting to YAML instead, which does support comments, using the TOML to YAML converter (toml-yaml).
TOML ↔ JSON
Convert TOML to JSON and JSON to TOML — live, bidirectional, and with syntax validation.
Open Tool