TOML to JSON Converter
TOML (Tom's Obvious Minimal Language) is a configuration file format used by Rust (Cargo.toml), Python (pyproject.toml), and other tools. To convert TOML to JSON: key-value pairs become JSON properties, [tables] become nested objects, [[array of tables]] become arrays of objects, and inline tables {key = val} become inline objects. TOML supports strings, integers, floats, booleans, datetimes, arrays, and tables.
Convert TOML configuration files to JSON. Supports tables, arrays of tables, inline tables, strings, integers, floats, booleans, and datetimes. Presets for Cargo.toml, pyproject.toml, and config files.
TOML Input
Options
TOML Syntax Reference
| TOML Syntax | JSON Equivalent | Notes |
|---|---|---|
| key = "value" | {"key": "value"} | Basic string |
| key = 'value' | {"key": "value"} | Literal string (no escapes) |
| num = 42 | {"num": 42} | Integer |
| pi = 3.14 | {"pi": 3.14} | Float |
| enabled = true | {"enabled": true} | Boolean |
| arr = [1, 2, 3] | {"arr": [1, 2, 3]} | Array |
| [table] | {"table": {...}} | Table (object) |
| [[array]] | {"array": [{...}]} | Array of tables |
| inline = {a = 1} | {"inline": {"a": 1}} | Inline table |
How to Use
- 1
Paste TOML content
Paste your TOML configuration file content into the input area, or click a preset (Cargo.toml, pyproject.toml, Config File)
- 2
Choose indentation
Select 2 spaces, 4 spaces, or minified output format
- 3
Review JSON output
The converted JSON appears instantly below with proper nesting of tables, arrays, and values
- 4
Copy the result
Click the copy button to copy the JSON output to your clipboard
Frequently Asked Questions
- What is TOML format?
- TOML (Tom's Obvious Minimal Language) is a configuration file format designed to be easy to read. It is used by Rust (Cargo.toml), Python (pyproject.toml), Hugo, Deno, and many other tools. TOML supports strings, integers, floats, booleans, dates/times, arrays, tables (objects), and inline tables.
- How are TOML tables converted to JSON?
- TOML tables (sections in [brackets]) become nested JSON objects. For example, [server] with port = 8080 becomes {"server": {"port": 8080}}. Dotted tables like [database.connection] create nested objects: {"database": {"connection": {...}}}.
- How are TOML arrays of tables converted?
- Double-bracket headers [[products]] define arrays of tables. Each [[products]] section adds a new object to the array. In JSON this becomes {"products": [{...}, {...}]}. This is commonly used in Cargo.toml for [[bin]] targets and in other configs for repeated sections.
- What TOML data types are supported?
- This converter supports all TOML data types: basic and literal strings, integers (decimal, hex 0x, octal 0o, binary 0b), floats (including inf and nan), booleans (true/false), datetime strings, arrays, tables, and inline tables. Underscores in numbers (1_000_000) are handled correctly.
- How do I convert Cargo.toml to JSON?
- Paste your Cargo.toml content into the input area (or click the "Cargo.toml" preset). The converter handles [package], [dependencies], [dev-dependencies], [[bin]], and all other sections. Dependencies with features like serde = { version = "1.0", features = ["derive"] } are converted to nested objects.
- How do I convert pyproject.toml to JSON?
- Paste your pyproject.toml content or click the "pyproject.toml" preset. The converter handles [project], [project.dependencies], [tool.ruff], [tool.pytest], [build-system], and all PEP 621 metadata fields. License tables, optional dependencies, and tool-specific sections are all converted correctly.