TOML to JSON Converter
100% private — runs on your device, never uploaded. Works offline once loaded.
Convert TOML config into JSON, or serialize JSON back into TOML, right in your browser. Tables, arrays of tables, inline tables, typed numbers, booleans and comments are all handled by a small built-in parser.
TOML and JSON, both directions
TOML (Tom's Obvious, Minimal Language) is the configuration format behind tools like Cargo, Poetry and many others. It is designed to be easy for humans to read, with named [tables] and unambiguous, typed values. JSON is the format machines and APIs speak. This converter bridges the two in both directions using a small parser and serializer written from scratch, so nothing you paste ever leaves your browser.
Reading TOML into JSON is useful when a script or web app needs to consume a config file. Going the other way — JSON to TOML — is handy for turning an API response or a generated object into a human-friendly config, or for migrating settings between tools that prefer different formats.
What the parser understands
The built-in TOML parser is line-oriented but aware of structure that spans lines, such as multi-line arrays. It resolves the full range of everyday TOML you are likely to hand-edit.
- Bare and quoted keys, plus dotted keys and dotted [table.names] that build nested objects.
- [[arrays of tables]], which collect repeated sections into a JSON array of objects.
- Inline tables like { host = "local", port = 5432 } and arrays, including nested and mixed-type arrays.
- Basic strings with escape sequences, literal 'single-quoted' strings, and triple-quoted multi-line strings.
- Integers (with underscores, hex, octal and binary), floats with exponents, inf/nan, and true/false booleans.
- Full-line and trailing # comments, which are ignored during parsing.
Serializing JSON back to TOML — and the caveats
Going from JSON to TOML, the serializer emits scalar and simple-array keys first, then nested objects as [table] sections, and arrays whose elements are all objects as [[array of table]] blocks. Keys that are not valid bare keys are automatically quoted, and strings are escaped correctly.
A few differences are unavoidable because the formats are not identical. JSON has no comments, so comments cannot survive a JSON → TOML → JSON round trip. JSON null has no TOML equivalent and is written as an empty string. TOML dates become JSON strings. Within those limits, a typical config round-trips faithfully, which the tool is built and tested to do.
Frequently asked questions
Does it handle arrays of tables ([[x]])?
Yes. Repeated [[servers]] sections become a JSON array of objects, and on the way back, a JSON array whose elements are all objects is written as [[servers]] blocks.
Are numbers converted to real numbers?
Yes. Integers and floats become JSON numbers, with support for underscores (1_000), hex/octal/binary integers, exponents, and inf/nan. Values that look like dates are kept as strings.
What happens to comments when converting?
Comments are recognised and skipped when parsing TOML. Because JSON has no comment syntax, they are not carried into the JSON output and cannot be reconstructed when converting back.
Why did my null become an empty string in TOML?
TOML has no null value. Rather than dropping the key, the serializer writes an empty string so the key is still present; adjust it by hand if you need different behaviour.
Can I paste a config with nested tables?
Yes. Dotted table headers such as [servers.alpha] and dotted keys build the corresponding nested JSON objects, and nested JSON objects are emitted as nested [table] sections.
Is my configuration data private?
Completely. Both the TOML parser and the JSON serializer run locally in your browser, so config files with secrets or internal details are never uploaded.
Advertisement