JSON to TOML Converter
Converts JSON objects to TOML config syntax, or TOML back to JSON. Covers core TOML: scalars, arrays of
primitives, and [table] headers. See the FAQ for what's deliberately out of scope.
About This Tool
TOML is the config format behind Cargo.toml, pyproject.toml, and plenty of
other tool configs, but data headed into one often starts life as JSON -- an API response, a generated
config object, a .json settings file being migrated. This converts between the two for the
core of the spec: scalars, arrays of primitives, and nested [table] sections.
It's a from-scratch parser and serializer, matching this site's existing hand-written YAML and CSV support rather than pulling in a dependency, so it's deliberately scoped -- see the FAQ for what's out. For YAML-based configs instead, use JSON to YAML.
Key Features
- Bidirectional conversion: one Direction dropdown (or the ⇌ swap button) switches between JSON → TOML and TOML → JSON.
- Nested
[table]headers: nested JSON objects become dotted[a.b.c]table headers. - Arrays of primitives: strings, numbers, and booleans serialize to
[1, 2, 3]-style TOML arrays. - Clear errors on unsupported constructs: dates, multi-line strings, inline tables, and arrays-of-tables raise a named error on
TOML → JSONinstead of corrupting data. - File upload: load a
.jsonor.tomlfile directly.
Example
{
"name": "demo-app",
"version": 2,
"server": { "host": "localhost", "port": 8080 }
} produces:
name = "demo-app" version = 2 [server] host = "localhost" port = 8080