JSON to TOML
Turn a JSON object into TOML, the format of pyproject.toml and Cargo.toml; null fields are reported by path
Your data stays with you. Conversion happens inside the browser; nothing is sent to a server.
Did this tool do the job?
Thanks, your feedback came through.
How it works
TOML is the configuration format that people read and edit by hand in Python's pyproject.toml, Rust's Cargo.toml and the settings of tools such as Hugo and Netlify. If your settings exist as JSON (generated by a script or returned by an API), paste them into the left pane; with Direction set to "JSON → TOML", the TOML appears on the right. In the sample, the "project" object becomes a [project] table, the list of author objects becomes [[project.authors]], and the nested "ruff" settings become a [tool.ruff] table. Because TOML has no null value, a field holding null is not silently dropped: the tool stops and names its path (for example "project.license"). The JSON root cannot be an array either, because a TOML document is always a table; put the array under a key first. Switch Direction to "TOML → JSON" and the same page works the other way, pointing to broken TOML by line and column.
This tool is also known as json to toml, json to toml converter, convert json to toml, json to toml online, generate toml from json.
What is TOML?
TOML (Tom's Obvious, Minimal Language) is a text format designed for configuration files: lines follow key = value, [section] headers group settings and # starts a comment. It knows strings, integers, floats, booleans, date-times, arrays and tables, but has no null type. Version 1.0 was released in 2021; Cargo.toml and pyproject.toml are its best-known uses.
What is TOML table and array of tables?
In TOML a [table] header collects the keys below it into one object, the equivalent of a nested JSON object; [a.b] goes one level deeper. An [[array]] header adds a new object to a list each time it appears, which is a JSON array of objects. Short objects can also be written on one line as { key = value }; such an inline table cannot be extended later on another line.
What is the difference between TOML and JSON?
Both carry the same data structures (objects, arrays, strings, numbers), but they were built for different jobs. JSON is for machine-to-machine exchange: strict syntax, no comments, and a null value. TOML is for configuration people edit: comments are allowed, [section] headers read like a flat list, date-times have their own type, and there is no null. That is why nulls need a decision in the JSON → TOML direction, and dates become strings in the TOML → JSON direction.
Pitfalls: null, number types and key order
A JSON null has no TOML equivalent. Many converters quietly delete the field, and you only notice the missing setting when the program behaves differently. This tool reports the path of the first null it finds and how many more there are, so you decide whether to delete the field or set it to an empty string "" or false.
JSON does not separate integers from decimals, TOML does: a value written 2.0 in JSON is read by JavaScript as 2, so TOML receives the integer 2. Keep values such as version numbers as strings ("1.0"). By TOML rules, plain keys are written before tables, so key order in the output may differ from the JSON while the meaning stays the same. Integers above 2^53 may be rounded while the JSON is read; the tool warns in the note when it sees one.
When to use TOML and when JSON
TOML was designed for configuration files that people edit: you can write # comments, and bare keys plus [section] headers keep a long file readable. Cargo, Poetry, uv, Ruff, Black and Hugo read their settings from TOML. JSON is better for data exchange between programs; it carries no comments, but every language has a ready-made parser.
Use JSON → TOML when a script produces settings that belong in Cargo.toml or pyproject.toml. To hand a TOML file to JavaScript, jq or an API, switch the direction; a separate page focuses on TOML to JSON conversion and validation.
Frequently asked questions
How do I convert JSON to TOML?
Paste the JSON object into the left pane on this page and leave Direction at "JSON → TOML". Nested objects turn into [table] headers and arrays of objects into [[table]] headers. Copy the result or download it as .toml.
What does the "TOML has no null value" error mean?
The TOML format does not define an empty (null) value. Your JSON contains a field whose value is null, and instead of deleting it silently the tool shows it to you. Remove the field named in the message or give it a value (an empty string "", 0 or false) and try again.
Why can't JSON with an array at the root become TOML?
A TOML document is always a table made of key = value pairs; an unnamed list cannot sit at the top. Put the array under a key, e.g. {"items": [ ... ]}; each record is then written under an [[items]] header.
Is my data sent to a server?
No. The conversion runs entirely in your browser with an open-source TOML library bundled into the page, so even a config file with passwords or access keys never leaves this page. Once loaded, the page also works offline.