Convert JSON to TOML
Turn JSON 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 JSON files on the dialor turn it to pick what to do
JSON data written as a TOML file.The keys and values stay the same. Plain values come first, then tables.
What you get
One TOML file with the same keys and values as the JSON. Plain values are written before tables, as TOML expects.
A JSON file whose top level is a list has no key to sit under. The list is written under the key items. When its entries are objects, each one becomes an
[[items]]table.What cannot be carried
TOML has no null. A null inside an object is dropped, and the conversion warns you about it. A null inside a list cannot be dropped that way, so the conversion fails.
An integer beyond the signed 64-bit range also fails, because TOML cannot hold it.
When a conversion stops
The conversion stops with
input_corruptedwhen the file could not be parsed as JSON. It stops withunsupported_elementswhen the file holds something TOML cannot carry, such as the nulls and large integers above.To go the other way, use TOML to JSON.
JSON and TOML.What each format is.
The formats
JSON
JSON, the data format of every API.
- Extensions
- .json
- MIME type
- application
/json - 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 JSON to TOML conversion through the API, for your app or your agent.
$ cv convert report.json report.toml$ cv convert report.json report.tomlQuestions.What people ask about JSON to TOML.
Yes. It is written under the key items. If its entries are objects, they become [[items]] tables.
A null in an object is dropped, with a warning. A null inside a list makes the conversion fail, since TOML cannot hold it.
It holds something TOML cannot carry, such as a null inside a list or an integer beyond the signed 64-bit range.
The file could not be parsed. The JSON must be readable before it can become TOML.