TOML to JSON Converter — bidirectional
Convert TOML to JSON and JSON back to TOML right in your browser. Spec-compliant (TOML v1.0.0, JSON RFC 8259 / ECMA-404), with type-mapping notes, error positions, and a round-trip integrity check. No signup, no uploads, sources cited below.
How it works
This is a deterministic format transform, not a calculator. It parses your input into an in-memory data structure, then serialises that structure into the target format. TOML parsing and serialisation use smol-toml (a zero-dependency library that passes the official toml-testsuite); JSON uses the browser's native JSON.parse and JSON.stringify. Everything runs client-side, so your config never leaves the page.
TOML → JSON
- Parse the TOML per the v1.0.0 grammar. Tables and inline tables become JSON objects; arrays of tables (
[[x]]) become arrays of objects; dotted headers like[tool.ruff]nest accordingly. - Map each scalar: string → string, integer and float → number (JSON does not distinguish the two), boolean → boolean. Because JSON has no date type, every TOML offset date-time, local date-time, local date, and local time is emitted as an ISO-8601 string — the one lossy edge, surfaced in the notes panel.
- Serialise with the chosen indentation (2, 4, tab, or minified) and, optionally, alphabetically sorted keys for stable version-control diffs.
JSON → TOML
- Parse the JSON per RFC 8259 / ECMA-404. The root must be an object, because TOML's top level is always a table — a bare array or scalar is rejected with a specific message.
- Reconcile against TOML's data model.
nullhas no TOML representation, so a null-valued key is omitted (and counted in the notes); a null inside an array is a hard error, because TOML arrays cannot contain one. Arrays whose items are all objects are written as arrays of tables. - Serialise with smol-toml, which emits spec-compliant tables, inline tables, and arrays of tables.
After either direction, the tool runs a round-trip integrity check: it re-parses its own output and structurally compares it to your input, accounting for the two documented lossy edges (dates becoming strings, null keys being dropped). A clean match shows “round-trip verified”; an expected lossy case shows “converted with notes”; anything else is flagged as a mismatch so you know not to trust it. Comments are not preserved in either direction — both parsers discard them.
Worked examples
Frequently asked questions
Sources & references
- TOML v1.0.0 specification — grammar and type system
- RFC 8259 — The JavaScript Object Notation (JSON) Data Interchange Format
- smol-toml v1.7.0 — spec-compliant TOML parser (passes toml-test)
- toml-test — the official TOML compliance test suite
Conversion behaviour was last verified against the TOML v1.0.0 spec, RFC 8259 / ECMA-404, and smol-toml v1.7.0 on 2026-06-24. The three worked examples above round-trip exactly as documented.
Related tools
Comments & feedback
Spotted a bug or want an improvement? Tell us — our team reviews every comment, and good ideas get built. Comments are public and anonymous.
Found a bug, an edge case, or a TOML file that doesn't round-trip?
Email me at [email protected] — most fixes ship within 24 hours.