Convert JSONC to TOML
Turn JSONC 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 JSONC files on the dialor turn it to pick what to do
Your JSONC as a TOML file.The keys and values stay the same. Comments and trailing commas are dropped.
What you get
A single TOML file with the same keys and values as your JSONC. Plain values are written before tables, as TOML expects.
A top-level list has no key in TOML, so it is written under the key items. When its entries are objects, each one becomes an
[[items]]table.What it leaves behind
Comments are dropped, and so are trailing commas. The data stays, but the notes you wrote beside it do not.
A null in an object is dropped with a warning, because TOML has no null. The key that held it is not in the output.
When it stops
A null inside a list fails, since TOML cannot hold it there. An integer beyond the signed 64-bit range fails for the same reason.
If the file cannot be parsed, the conversion stops with
input_corrupted. To go the other way, use TOML to JSONC.
JSONC and TOML.What each format is.
The formats
JSON with Comments
JSON that allows comments, as in editor and TypeScript configuration files.
- Extensions
- .jsonc
- MIME type
- text
/x -jsonc - 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 JSONC to TOML conversion through the API, for your app or your agent.
$ cv convert report.jsonc report.toml$ cv convert report.jsonc report.tomlQuestions.What people ask about JSONC to TOML.
No. Comments are dropped along with trailing commas. Only the keys and values are written to the TOML file.
A null in an object is dropped with a warning. A null inside a list makes the conversion fail, since TOML can hold neither.
It is written under the key items. If its entries are objects, they become [[items]] tables.
The file could not be parsed. The conversion stops with input_corrupted when the JSONC is not readable as JSONC.