Output appears here.
TOML to JSON converts TOML configuration — Cargo.toml, pyproject.toml, Hugo or Netlify configs — into formatted JSON. Tables become objects, arrays of tables become arrays, and TOML dates become ISO 8601 strings. Use it to feed a config into jq, a JSON Schema check or a script. Everything runs in your browser — nothing is uploaded.
How to convert TOML to JSON
- Paste TOML or drop a
.tomlfile, or load the Cargo.toml example. - Choose the Indent — 2 spaces, 4 spaces or a tab. The document is parsed as TOML 1.0 first, so syntax errors are reported with line and column before any output appears.
- Copy or download the
.json, then use Format JSON, Convert to YAML, or Back to TOML to keep working without re-pasting.
Examples
Cargo.toml
[package] and [dependencies] become objects, the inline table stays an object, and [[bin]] becomes an array:
[package]
name="formattr"
version = "1.0.0"
authors=["Sam"]
[dependencies]
serde={version="1.0",features=["derive"]}
[[bin]]
name="fmt"
path="src/main.rs"Result:
{
"package": {
"name": "formattr",
"version": "1.0.0",
"authors": [
"Sam"
]
},
"dependencies": {
"serde": {
"version": "1.0",
"features": [
"derive"
]
}
},
"bin": [
{
"name": "fmt",
"path": "src/main.rs"
}
]
}Dates and times
TOML has four date-time types; JSON has none, so each becomes an ISO 8601 string with milliseconds added. Offset datetimes keep their Z or offset; local values keep no zone:
title = "Release"
released = 2026-09-26T09:00:00Z
local = 2026-09-26T09:00:00
day = 2026-09-26
at = 07:30:00
[owner]
name = "Sam"Result:
{
"title": "Release",
"released": "2026-09-26T09:00:00.000Z",
"local": "2026-09-26T09:00:00.000",
"day": "2026-09-26",
"at": "07:30:00.000",
"owner": {
"name": "Sam"
}
}Number formats
Hexadecimal and underscore-separated integers become plain JSON numbers. A float with no fractional part loses its .0, and inf and nan, which JSON cannot represent, become null with the notice "JSON has no inf or nan — 2 values were written as null.":
hex = 0xFF
inf = inf
nanv = nan
small = 1_000_000
f = 3.0Result:
{
"hex": 255,
"inf": null,
"nanv": null,
"small": 1000000,
"f": 3
}Options explained
- Indent — the number of spaces (2 or 4) or a tab used for each nesting level in the JSON output. It is also stored in the page URL.
Common TOML to JSON errors
Large integers in the JSON
TOML integers are 64-bit, and the converter copies them digit for digit, so 9007199254740993 stays 9007199254740993 even though it is larger than 2^53. The JSON is exact; a consumer that parses it into double-precision numbers, such as JavaScript's JSON.parse, may still round it. Quote IDs as strings in the TOML if every reader must see the same value.
"trying to redefine an already defined table or value"
A key or [table] header appears twice. JSON objects cannot have duplicate keys either, so merge the definitions; use [[double brackets]] when you really mean a list.
A datetime gained .000
Datetimes and times are written with millisecond precision, so 2026-09-26T14:30:00+05:30 becomes "2026-09-26T14:30:00.000+05:30". The instant and the offset are unchanged. Most JSON consumers accept both forms; strip .000 in your own code if a strict parser needs whole seconds.
Comments are missing from the JSON
JSON has no comment syntax, so TOML comments cannot be carried over. Keep the TOML file as the source of truth and generate JSON from it when needed.
"invalid value" on a word
An unquoted string, such as mode = fast, is not valid TOML. Quote it: mode = "fast". A word that begins like a TOML value, such as level = info, fails one step later with "each key-value declaration must be followed by an end-of-line", and the hint shows the quoted form. The TOML Formatter validates a file on its own if you want to fix it before converting.
FAQ
How do I convert pyproject.toml to JSON?
Paste the file and copy the JSON. [project] becomes an object, [tool.ruff] becomes a nested tool.ruff object, and dependency lists become arrays of strings. This is useful when a CI step or a script expects JSON, or when you want to query the config with jq.
Why do dates come out as strings?
JSON has no date type. The converter writes dates as ISO 8601 strings, the format almost every JSON consumer understands. Offset datetimes keep their Z or +05:30-style offset, local dates stay as plain dates, and datetimes and times gain milliseconds. Parse them back with your language's ISO 8601 reader.
Does the key order stay the same?
Yes. Keys appear in the order they were defined in the TOML file, and array order is preserved. Sub-tables appear where their header was first defined relative to other keys of the same parent.
What happens to inf and nan?
TOML allows the floats inf, -inf and nan, but JSON does not. JSON.stringify writes them as null, and so does this converter, with a notice that says how many values were replaced. If those values matter, store them as strings in the TOML or handle them in the code that reads the config.
Is my config file uploaded?
No. The file is parsed and converted in your browser, inside an isolated frame that blocks network requests. The indent setting is remembered on this device; the content is not stored unless you turn on "Remember my last input".
TOML to JSON type mapping
| TOML | JSON |
|---|---|
[table], inline table { } |
object |
[[array of tables]] |
array of objects |
| string (basic, literal, multi-line) | string |
| integer (decimal, hex, octal, binary) | number |
| float | number; inf and nan → null |
| boolean | boolean |
| offset date-time | ISO 8601 string with its offset |
| local date-time, date, time | string without a zone |
Related tools
Reverse the conversion with JSON to TOML, pretty-print or validate the result with the JSON Formatter, or turn it into YAML with JSON to YAML. Browse all converters under Data.