Skip to content
UniKit

JSON to TOML

Turn JSON into TOML: nested tables, arrays and arrays of tables ([[table]]), optional key sorting and integer-as-float output. Bad JSON reports line and column, while nulls and root arrays get a clear suggestion.

Runs in your browserEvery computation happens in your browser — your data never leaves this device.

Options

TOML

What this tool does

  • Write Cargo.toml, pyproject.toml or Hugo / Zola site config by drafting the structure as JSON and converting it to TOML.
  • Nested objects become [table] sections and arrays of objects become [[items]] arrays of tables, so you never have to decide between dotted keys and headers.
  • Validate the shape on the way in: TOML has no null, so a null reports the exact path and suggests a replacement instead of a vague parse error.
  • Sort keys when you want a stable config file, and write integers as floats (1 becomes 1.0) when the numeric type matters.

Example

Input

{"title":"UniKit","server":{"host":"localhost","port":8080}}

Output

title = "UniKit"

[server]
host = "localhost"
port = 8080

The root must be an object. TOML requires scalar keys before any sub-table, so plain keys first and [table] blocks after is the spec talking, not a formatting choice.

Frequently asked questions

What if my JSON contains null?

TOML has no null type, so the tool fails and names the exact path (say user.email). Replace it with an empty string "", 0 or false, or drop the key entirely.

Can the root be an array or a single value?

No. A TOML document must be a table at the root, so both are rejected with a suggestion: wrap the array in a key as { "items": [ … ] }, or use [[items]] tables when the elements are objects.

Why is the key order different from my JSON?

TOML requires all plain key/value pairs to appear before any sub-table, so leaf values are emitted first and [table] sections after. Tick "sort keys" for a fully deterministic order — it sorts recursively by key name while keeping array order.

Do numbers lose precision?

Only beyond what JSON itself already loses. JSON numbers are parsed as JavaScript doubles, so an integer past 2^53 is already imprecise before the conversion starts — a JSON limitation, not a TOML one. The output writes the parsed value as-is.

Is my JSON uploaded anywhere?

No. Parsing, validation and serialization all run locally in your browser, with no network requests, and it works offline.

Keywords:jsontomlconvertserializejson 转 toml配置格式转换序列化table

Related tools