TOML → JSON Converter
Why use a private TOML to JSON converter?
TOML is the native config format for Rust (Cargo.toml), Python packaging (pyproject.toml), and many other tools. But plenty of downstream tooling — build scripts, APIs, linters, and CI systems — only accepts JSON. Converting by hand is error-prone because TOML's type system (inline tables, arrays of tables, four datetime variants) doesn't map directly to JSON syntax.
This converter handles the full TOML v1.0 spec and runs entirely in your browser. Config files that contain database credentials, API keys, or internal service addresses are never transmitted anywhere.
How it works
The input is parsed using a TOML v1.0-compliant parser that builds an intermediate JavaScript object. TOML tables become JSON objects, TOML arrays of tables ([[double brackets]]) become JSON arrays, and all four TOML datetime types (offset datetime, local datetime, local date, local time) are serialized as ISO 8601 strings since JSON has no native datetime type.
Dotted keys (a.b.c = 1), inline tables, and multi-line basic and literal strings are all handled. The output is formatted with 2-space indentation.
Common use cases
- Converting Cargo.toml dependency and workspace sections to JSON for custom tooling
- Translating pyproject.toml [tool.*] sections to JSON for CI/CD scripts that parse config
- Exporting Hugo or Zola site config (config.toml) to JSON for build pipeline consumption
- Converting Taplo-formatted TOML configs to JSON for APIs that only accept JSON payloads
- Inspecting TOML structure by converting to JSON and running JSONPath queries
- Migrating application config from TOML to a JSON-based config management system
Frequently asked questions
- How are TOML arrays of tables converted?
- TOML arrays of tables (sections defined with [[double brackets]]) become JSON arrays of objects. Each [[table]] entry becomes one element in the array, preserving insertion order.
- How are TOML datetime values handled?
- TOML has four datetime types: offset datetime, local datetime, local date, and local time. All four are converted to ISO 8601 strings in the JSON output, since JSON has no native datetime type.
- Can I convert Cargo.toml or pyproject.toml files?
- Yes. Cargo.toml and pyproject.toml are valid TOML files. The converter handles all features used in those files, including dotted keys, inline tables, and multi-line strings.
- Is it safe to convert config files that contain secrets or credentials?
- Yes. The conversion runs entirely in your browser using a client-side TOML parser — no part of your config file is transmitted to any server. This makes it safe for files that reference database passwords, API keys, or internal hostnames.