TOML ↔ JSON
Convert between TOML and JSON formats. Real-time conversion.
About this tool
Convert between TOML and JSON in either direction, with live conversion as you type. TOML is the format used by Rust's Cargo.toml, Python's pyproject.toml, Hugo, and many other modern config files; JSON is what most APIs and programmatic tooling expect. This tool bridges the two without installing any toolchain on your machine.
TOML → JSON example: a section header [server] with port = 8080 becomes a nested JSON object with a server key whose value is an object containing port; an array-of-tables [[users]] repeated twice becomes a JSON array of two objects.
JSON → TOML example: a JSON object with a top-level name key and a nested db object containing host and pool becomes a root key name = "app" followed by a [db] section with host and pool keys.
Supports tables, arrays-of-tables, inline tables, dotted keys, basic and literal strings (including multiline), integers, floats, booleans, hex/octal/binary integers, and ISO-8601 datetimes (preserved as strings). Local dates and times without timezone are also kept as strings.
FAQ
How are TOML datetimes handled? ›
Datetimes, dates, and times are preserved verbatim as strings in the JSON output, matching how they appear in the TOML source (e.g. "2024-01-15T10:30:00Z"). The JSON side never tries to parse them into Date objects, so the round-trip back to TOML keeps the exact representation.
What TOML features are not supported? ›
Hex/octal/binary integers are parsed to their decimal value. Very large integers exceeding JavaScript Number.MAX_SAFE_INTEGER may lose precision. Multi-document TOML files are not part of the spec, so they are not relevant here.
Why does my JSON-to-TOML output reorder keys? ›
The serializer groups scalars at the top of each table, followed by nested tables and arrays-of-tables. This is required by TOML, which mandates that all keys in a section appear before any sub-table headers.
Are arrays of mixed types supported? ›
Yes, but to keep the output valid they are emitted inline on a single line (e.g. mixed = [1, "two", true]). Arrays whose every element is an object become TOML arrays-of-tables with [[header]] syntax.
Can I also convert between YAML and JSON? ›
Yes — use the YAML ↔ JSON converter for bidirectional YAML↔JSON conversion. TOML↔JSON and YAML↔JSON are different format pairs, so each has its own dedicated tool covering the specific encoding rules and edge cases of that pair.