TOML to JSON converter
Paste a TOML file to get JSON, or switch the direction and paste JSON to get TOML. The TOML is checked first, so duplicate keys and malformed values are reported with their line and column.
Runs in your browser: nothing you enter is sent anywhere.
How to use it
- Choose the direction.
- Paste TOML or JSON. For TOML to JSON, pick the indent; for JSON to TOML, decide what to do with nulls.
- Copy the result.
Example
[owner]
name = "Ada"
[[servers]]
name = "alpha"
gives
{"owner": {"name": "Ada"}, "servers": [{"name": "alpha"}]}
Tips
The order of top-level values in TOML matters: values that appear after a [table] header belong to that table. When generating TOML from JSON, plain values are always placed first for this reason. To only tidy a TOML file without converting it, use the TOML formatter.
Frequently asked questions
How are TOML dates and times converted?
JSON has no date type, so offset date-times, local dates and times become strings exactly as written, for example "1979-05-27T07:32:00Z". Going back, they are written as ordinary strings, so a round trip does not restore the date type.
What about integers in hex, octal or binary?
They are converted to ordinary numbers (0xFF becomes 255). Integers beyond about 9 quadrillion lose precision, because JSON numbers are read as doubles in JavaScript. The values inf and nan have no JSON form and are reported as an error.
How is JSON written as TOML?
Plain values come first, then each nested object as a [table] with dotted names, and arrays of objects as [[array of tables]]. Arrays that mix objects with other values are written inline. Keys that are not letters, digits, - or _ are quoted.
Why does JSON to TOML refuse null?
TOML has no null value. You can remove the key yourself or turn on "Drop null values", which leaves those keys and array items out.
Does it support all of TOML 1.0?
It reads the common subset: tables, arrays of tables, dotted keys, all string forms, numbers, booleans, dates, arrays and single-line inline tables. Syntax errors that fall outside the subset are reported rather than guessed.