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.

  1. 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.

  2. 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.

  3. 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.

  4. 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

From · JSON5

JSON5

JSON with comments, trailing commas and unquoted keys.

Extensions
.json5
MIME type
application/json5
Kind
Text and data
To · TOML

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.

terminal
$ cv convert report.json5 report.toml
$ cv convert report.json5 report.toml

Questions.What people ask about JSON5 to TOML.

01OF 04

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.

More conversions.Other ways in and out of JSON5 and TOML.