JSON to TOML Converter
Paste JSON and get valid TOML 1.1 as you type. Nested objects become tables, lists of objects become arrays of tables, and anything TOML cannot hold is flagged. It runs in your browser, so nothing is uploaded.
Converts as you type. Ctrl/⌘+Enter converts now,Ctrl/⌘+Shift+C copies the TOML.
- Private by designRuns in this tab. No upload, no server code.
- TOML 1.1 outputTables and arrays of tables, in the right order.
- Exact numbersBig IDs keep every digit; 30.0 stays a float.
- Nothing lost silentlyEvery null and wrapped value is listed.
Example: a deploy config in JSON and TOML
{
"build": {
"command": "npm run build",
"publish": "dist"
},
"redirects": [
{
"from": "/blog/*",
"to": "/news/:splat",
"status": 301
},
{
"from": "/old-pricing",
"to": "/pricing",
"status": 302,
"force": true
}
]
}[build]
command = "npm run build"
publish = "dist"
[[redirects]]
from = "/blog/*"
to = "/news/:splat"
status = 301
[[redirects]]
from = "/old-pricing"
to = "/pricing"
status = 302
force = truebuild object becomes a [build] table, and each object in theredirects list becomes its own [[redirects]] block, the layout anetlify.toml file uses.How JSON data types map to TOML
JSON and TOML share most value types, so most of a JSON file carries over unchanged. The differences are in structure and in one missing type: TOML has no null.
| JSON | TOML | Written as |
|---|---|---|
| object (top level) | root table | key = value |
| nested object | table | [server.http] |
| array of objects | array of tables | [[products]] |
| array of values | array | ports = [ 80, 443 ] |
| string | basic string | name = "app" |
| whole number | integer (64-bit kept) | id = 9007199254740993 |
| number with a decimal point | float | timeout = 30.0 |
| true / false | boolean | debug = false |
| null | no TOML type | removed, or "", with a warning |
What happens to null values when converting JSON to TOML?
TOML has no null, so a key set to null cannot be written as it is. The converter removes the key and lists it under the output with its full path, such as project.license. If your program expects the key to exist, switch the null values option to write an empty string instead.
How are nested JSON objects written in TOML?
Each nested object becomes a table header with a dotted path, such as [tool.ruff]. Plain keys are written before any table, because in TOML every key after a header belongs to that header.
Does the converter keep integers and floats apart?
Yes. 30 stays an integer and 30.0 stays a float. Most converters turn both into30. Large IDs above 253 also keep every digit instead of being rounded.
What the converter changes in your output
- Top-level arrays and values are placed under a
rootkey, because a TOML document must start as a table. - Key order follows the TOML rule: plain keys first, then
[tables], then[[arrays of tables]]. - Keys with spaces, dots or non-ASCII letters are quoted, for example
"my key" = 1. - Comments cannot come across, because strict JSON has none.
Why does a top-level JSON array need a key in TOML?
A TOML file is always a table of key and value pairs. A JSON file that starts with [ has no key to hang the list on, so the converter names it root and tells you it did.
Can I convert JSON with comments or trailing commas?
Not yet. The converter reads strict JSON, so a tsconfig.json with comments shows an error at the first comment. Remove comments and trailing commas first.
Where TOML configuration files are used
Converting JSON to TOML usually means moving settings into one of these files:
- Cargo.tomlRust package manifest
- pyproject.tomlPython packaging and tool settings
- hugo.tomlHugo site configuration
- wrangler.tomlCloudflare Workers configuration
- netlify.tomlNetlify build and redirect rules
JSON vs TOML for configuration files
| Feature | JSON | TOML |
|---|---|---|
| Comments | No | Yes, with # |
| Null | Yes | No |
| Date and time type | No, strings only | Yes, four types |
| Trailing commas | No | In arrays; in inline tables from TOML 1.1 |
| Deep nesting | Braces at every level | Dotted table headers |
| Typical use | APIs and data exchange | Hand-edited config files |
Is TOML better than JSON for config files?
For files people edit by hand, usually yes: TOML allows comments, has real dates, and reads well without braces. JSON stays the better choice for data that programs send to each other.
How do I convert TOML back to JSON?
Use the TOML to JSON converter. It works the same way, in the other direction.
Is your JSON private?
Yes. The conversion runs as JavaScript in your browser tab. The site has no server code, and its security policy blocks the page from sending data anywhere. Your last input is kept only in this browser so it is still there when you come back; Clear removes it.
Is my JSON uploaded to a server?
No. Opening a file reads it on your device. You can check this in your browser's network panel: converting makes no requests.