JSON to TOML Converter
Paste a JSON object on the left, get TOML on the right. Strict spec compliance via @iarna/toml. Runs entirely in your browser — no upload.
- Paste a JSON object into the left textarea.
- Click "Convert to TOML". The top level must be a JSON object — not an array.
- Copy or download the TOML output.
- For lists of records, use a TOML array of tables — wrap with `{ items: [...] }` first.
What does it do?
Converts a JSON object to a TOML 1.0-compliant document via @iarna/toml. Nested objects become `[section]` headers; arrays of objects become `[[items]]` array-of-tables blocks; strings, numbers, booleans, and ISO 8601 datetime strings map to TOML primitives. The output is sorted to a canonical order — keys appear before sub-tables for compatibility with strict TOML parsers.
Example
JSON input:
{
"name": "Ada",
"active": true,
"address": {
"city": "London"
}
} TOML output:
name = "Ada"
active = true
[address]
city = "London" Common JSON-to-TOML pitfalls
TOML has stricter top-level rules than JSON. The patterns below explain why a JSON value that "should work" might fail.
- Top-level array. TOML cannot represent a top-level JSON array. Wrap it: `{"items": [...]}`. The result becomes a TOML array-of-tables under `[[items]]`.
- Top-level scalar. A bare `42` or `"hello"` JSON document has no key to attach to in TOML. Wrap it in an object: `{"value": 42}`.
- null values. TOML has no null type. The serializer omits keys whose JSON value is null entirely. If you need to represent "explicitly nothing", use an empty string `""` or a sentinel value, depending on your downstream code.
- Mixed-type arrays. TOML 1.0 allows `[1, "two"]`, but legacy 0.5 parsers do not. If your TOML must round-trip through 0.5 tooling, keep arrays homogeneous in the JSON before converting.
- Keys with dots in TOML output. A JSON key like `"my.key"` becomes a TOML "dotted key" path, which TOML parsers will interpret as nested. To preserve a literal dot in the key name, the serializer quotes it: `"my.key" = ...` — but consumers may still parse it as a path.
- NaN / Infinity. TOML 1.0 supports `nan`, `inf`, `-inf` literals. JSON does not represent these — they typically arrive as the strings `"NaN"`, `"Infinity"`, etc. Convert manually if you need true TOML float specials.
Frequently asked questions
How are dates represented?
JSON dates are ISO 8601 strings, e.g. `"2026-04-26T12:00:00Z"`. The serializer keeps them as strings in TOML — not as native datetime types. To get a native TOML datetime, you would need to pre-process and emit the value with the right type marker on the JavaScript side.
Are deeply nested objects flattened?
No — they become nested `[a.b.c]` headers. Each level of nesting becomes a dot-joined header path. For very deep structures, the output can have long header lines; that is just how TOML expresses depth.
Will key order be preserved?
Mostly. The serializer canonicalizes order so primitives come before sub-tables (a TOML rule). Within each tier, JSON insertion order is preserved.
How do I get a TOML inline table on output?
You cannot — the serializer always uses `[section]` block headers, never inline tables. If you need inline output, post-process the result. Inline tables are a TOML readability feature, not a different data shape.
Is my JSON uploaded?
No. Everything runs in your browser — your input is parsed and serialized by JavaScript on this page and never sent to any server.
Can I round-trip JSON → TOML → JSON?
For supported types (string, number, boolean, nested object, array of objects), yes. Round-trips lose null values (TOML has no null) and may normalize key ordering.