katlab tools/toml support on Ko-fi

TOML ↔ JSON ↔ YAML Converter

Paste TOML on the left to get JSON or YAML on the right, or paste JSON/YAML on the right to get TOML. Both sides convert live, with errors that name the line or key path. You can also drop a file onto either pane.

Everything runs locally in your browser. Nothing is sent to a server.
TOML

What TOML is and where you meet it

TOML (Tom's Obvious, Minimal Language) is a configuration format built to map unambiguously onto a hash table. It reads like an INI file — key = "value" lines grouped under [section] headers — but has a real specification (TOML 1.0) with typed values: strings, integers, floats, booleans, arrays, tables and four kinds of date and time. You will find it in Cargo.toml for every Rust crate, pyproject.toml for Python packaging and tools like Poetry, Ruff and uv, Hugo site configs, and netlify.toml build settings. Converting TOML to JSON is handy when a script or API only speaks JSON, when you want to inspect exactly how a nested [[bin]] array or a dotted key such as tool.ruff.line-length resolves, or when you are moving settings between a TOML file and a YAML-based CI config. This converter parses TOML 1.0 with smol-toml, shows the resulting structure as JSON or YAML, and lets you edit that side and get TOML back.

How TOML types map to JSON and YAML

TOMLJSON / YAML outputBack to TOML
table [a], inline table, dotted keyobject / mapping[a] header, nested tables as [a.b]
array of tables [[a]]array of objects[[a]]
integernumber (exact digits kept above 253)integer if whole, 64-bit range only
float, inf, nannumber; inf/nan become stringsfloat
date and time valuesISO 8601 stringdate/time if the string matches
—nullerror naming the key path

JSON numbers do not distinguish integers from floats, so a TOML float like 3.0 comes out as 3 and returns to TOML as the integer 3. Integers beyond 253 are written to JSON with every digit intact, but many JSON consumers will round them; YAML input is read with the YAML 1.2 core schema, which reads such integers as ordinary (rounded) numbers. Key order is preserved as written, with two exceptions: generated TOML lists each table's plain values before its sub-tables and arrays of tables (TOML requires it, since everything after a [header] belongs to that header), and JavaScript moves integer-like keys such as 10 ahead of other keys in the same table.

Dates and times: the part JSON cannot hold

TOML has four temporal types — offset date-time (1979-05-27T07:32:00Z or -07:00), local date-time (no offset), local date and local time. JSON and the YAML core schema have none of them, so this tool writes each one as an ISO 8601 string and shows a note under the output listing how many of each kind were converted. The offset is kept exactly as written rather than shifted to UTC, a space between date and time is normalised to T, and fractional seconds are kept to millisecond precision (.999999 becomes .999). Going the other way, the ISO strings → TOML dates option turns strings in exactly those four shapes back into unquoted TOML dates, which is what makes a TOML → JSON → TOML round trip lossless for dates. Untick it if a value like "2024-01-01" must stay a quoted string, for example a version label.

Converting JSON or YAML to TOML

A TOML document is always a table, so the JSON or YAML root must be an object — a root array or single value is rejected. TOML has no null, so rather than silently dropping keys the converter stops and names the exact path, such as dependencies.serde.features[2]. Nested objects become [table] headers, arrays whose items are all objects become [[array of tables]], and other arrays stay inline, including mixed-type arrays, which TOML 1.0 allows. YAML streams with several --- documents are rejected because TOML holds one document. Comments and original formatting do not survive any conversion.

Is my TOML, JSON or YAML uploaded anywhere?

No. Parsing and conversion run entirely in your browser using self-hosted copies of the smol-toml and js-yaml libraries, loaded from this site with no third-party requests. Config files containing secrets never leave your device.

What happens to TOML dates and times when converting to JSON or YAML?

JSON has no date type, so every TOML offset date-time, local date-time, local date and local time becomes an ISO 8601 string, and a note under the output says how many were converted. Fractional seconds are kept to millisecond precision. When converting back to TOML, strings in those exact ISO shapes become TOML dates again unless you untick the option.

Why does my JSON show an error about null?

TOML has no null value. Instead of silently dropping the key, the converter stops and names the key path that holds null, for example servers[1].host, so you can remove the key or give it a real value.

Can a JSON array be converted to TOML?

Only inside an object. A TOML document is always a table at the top level, so a JSON or YAML document whose root is an array, string or number is rejected with an error. Wrap it in an object, for example {"items": [...]}, and it converts to an array of tables.

Are TOML comments and formatting preserved?

No. Comments are dropped because JSON has no comment syntax, and generated TOML uses one consistent layout: nested objects become [table] headers, arrays of objects become [[array of tables]], and dotted keys are expanded. The data is kept; key order is kept too, except that TOML needs a table's plain values written before its sub-tables.