Convert JSON5 to TOML
Turn JSON5 files into TOML. The same keys and values as TOML, with plain values written before tables, and a top-level list is written under the key items, as [[items]] tables when its entries are objects.
Converted in an isolated sandbox on our serversDeleted after 24 hours
Drop JSON5 files on the dialor turn it to pick what to do
JSON5 settings as a TOML file.The same keys and values, written as TOML. Comments are dropped.
What you get
A single TOML file with the same keys and values as the JSON5 file. Plain values are written before tables, as TOML expects.
JSON5 numbers become plain numbers. Unquoted keys and trailing commas are read as JSON5 allows and written out as ordinary TOML.
Top-level lists
TOML needs a key at the top, so a list at the top of the JSON5 file is written under the key items. When the entries are objects, each one becomes an [[items]] table.
What it leaves behind
Comments are dropped, because the conversion does not carry them into the TOML file.
A null inside an object is dropped, and the conversion gives a warning. TOML has no null, so the key does not appear in the output.
When it stops
A null inside a list fails, since TOML cannot hold it. An integer beyond the signed 64-bit range fails for the same reason. The conversion stops with
unsupported_elements.If the file cannot be parsed as JSON5, the conversion stops with
input_corrupted.To go the other way, use TOML to JSON5.
JSON5 and TOML.What each format is.
The formats
JSON5
JSON with comments, trailing commas and unquoted keys.
- Extensions
- .json5
- MIME type
- application
/json5 - Kind
- Text and data
TOML
TOML configuration files, the format of Cargo and pyproject.
- Extensions
- .toml
- MIME type
- application
/toml - Kind
- Text and data
In your code.The same JSON5 to TOML conversion through the API, for your app or your agent.
$ cv convert report.json5 report.toml$ cv convert report.json5 report.tomlQuestions.What people ask about JSON5 to TOML.
No. Comments in the JSON5 file are dropped.
A null in an object is dropped with a warning. A null inside a list fails, because TOML can hold neither.
It is written under the key items. If its entries are objects, they become [[items]] tables.
The file holds something TOML cannot carry, such as a null inside a list or an integer beyond the signed 64-bit range.