JSON to TOML Format Conversion — Numio
Converts a JSON object to TOML. Nested objects become [table] sections, arrays of objects become [[array of tables]], and keys with null values are dropped because TOML has no null.
Turning a JSON config into pyproject.toml, Cargo.toml, wrangler.toml or Hugo config syntax.
When to use it
- Turning a JSON config into pyproject.toml, Cargo.toml, wrangler.toml or Hugo config syntax.
- Moving settings generated by a script as JSON into a TOML-based configuration file.
How to use
- Paste a JSON object (the root must be an object, not an array) into the left editor, or use the load-file button to open a UTF-8 file.
- Check the TOML on the right: scalar keys come first, then [table] and [[array]] sections.
- Copy the result, then compare it with the target tool's documented keys before replacing your config.
JSON object
{
"title": "My App",
"port": 8080,
"debug": false,
"owner": { "name": "Ada", "since": "2024-01-05T10:00:00Z" },
"servers": [
{ "host": "a.example.com", "weight": 3 },
{ "host": "b.example.com", "weight": 1 }
],
"ports": [80, 443]
}TOML
title = "My App" port = 8_080 debug = false ports = [ 80, 443 ] [owner] name = "Ada" since = "2024-01-05T10:00:00Z" [[servers]] host = "a.example.com" weight = 3 [[servers]] host = "b.example.com" weight = 1
Details and limitations
Integers of 1000 or more get underscore separators (8080 becomes 8_080). This is valid TOML and parses to the same number.
Date strings stay quoted strings; JSON has no date type, so no TOML datetime values are produced.
Keys with null values are silently omitted, and 1.0 in JSON is written as the integer 1.
Runs in your browser with @iarna/toml. A list that mixes objects with other values is rejected, because TOML arrays of tables cannot hold them. Sub-tables are indented by two spaces; TOML ignores this.
FAQ
Can I convert a JSON array at the root?
No. A TOML document must be a table, so the page explains that the JSON is an array and suggests wrapping it in an object, e.g. {"items": [...]}.
What happens to null values?
The key is dropped. {"a": null} produces empty output. Use an empty string or remove the key deliberately if the target expects it.
Why do numbers contain underscores?
The serializer formats large integers with _ digit separators, which the TOML spec allows. Any TOML parser reads 8_080 as 8080.