TOML to JSON

Read a Cargo, pyproject or Netlify style config and get the JSON your tooling can work with.

TOML
JSON
Runs locally in your browser

About the TOML to JSON

Configuration lives in TOML, but scripts and diff tools prefer JSON. This converter runs a TOML 1.0 parser written for the browser: bare and quoted keys, dotted keys, basic and literal strings, multi line strings, integers with underscores, floats, booleans, offset and local dates, inline tables, arrays and arrays of tables all map onto their JSON equivalents.

Errors are reported with a line and a column rather than a bare complaint, and the editor marks the spot. The common mistakes it catches are a key defined twice, a table header reopened after it was already closed, a missing closing bracket and a value placed after a table header that was meant for the level above.

Dates and times deserve a note. TOML has real date types while JSON does not, so an offset date time becomes the ISO string it was written as. That keeps the value readable and comparable, and any date library will parse it back. Numbers written in hexadecimal, octal or binary come out as ordinary JSON numbers.

Sorting keys makes two generated files comparable, and minifying is useful when the output feeds a script rather than a reader. Once you have JSON, the JSON Diff tool can compare two configs field by field, and JSON to TOML converts back again.

How to use

  1. Paste the TOML file, or press Sample to load a service config with tables and jobs.
  2. Choose the indent, or tick Minify output for a single line result.
  3. Fix any error the parser reports at the marked line and column.
  4. Copy the JSON or download config.json.

Common questions

Which version of TOML is supported?
The 1.0 grammar, including dotted keys, inline tables, arrays of tables, multi line strings and the full set of date and time forms.
What happens to TOML dates?
They become ISO 8601 strings, since JSON has no date type. The text is unchanged, so any date library can parse it back.
Why is a duplicate key an error?
TOML forbids defining the same key twice. Reporting it is more useful than silently keeping the last value and hiding a real mistake.
Are comments preserved?
No. JSON has no comment syntax, so the parser counts comments but drops them from the output.