How to use it
- Paste TOML into the input, or try the example.
- Choose 2 or 4 spaces of indentation.
- Copy the JSON or download it as a .json file.
How it works
The TOML is parsed with the open-source smol-toml library, which implements TOML 1.0 and rejects invalid documents such as duplicate keys, redefined tables or missing values. The first error is shown with its line and column; the message text comes from the library and is in English.
Tables become JSON objects and arrays of tables become arrays of objects. Dates and times have no JSON type, so they become ISO 8601 strings in the form they were written: an offset date-time keeps its offset, local dates stay as yyyy-mm-dd and local times as hh:mm:ss. Integers larger than JavaScript can hold exactly are written as exact JSON numbers. inf and nan cannot be written in JSON and become null, with a note.
TOML does not distinguish integers and floats in a way JSON keeps: 1.0 is written as 1. Comments are dropped. The other direction is JSON to TOML.
Examples
pyproject.toml
The [project] table with name, version and dependencies becomes a JSON object you can query with jq or load in a script.
Finding a syntax error
If a key is defined twice, the error names the line and column of the second definition.
Frequently asked questions
Which TOML version is supported?
TOML 1.0, including mixed-type arrays, dotted keys and all date and time types.
What happens to dates?
They become strings in ISO 8601 form, for example 1979-05-27T07:32:00.000-08:00 or 1979-05-27 for a local date.
Why is the error message in English?
Syntax error messages come from the TOML parser library. The line and column tell you where to look.
Privacy
The conversion runs entirely in your browser. Your TOML and JSON are not uploaded or stored.