JSON ↔ TOML Converter.
Convert JSON to TOML 1.0 and TOML to JSON, with tables, arrays of tables and exact error positions.
Runs in your browserAbout JSON ↔ TOML Converter
The JSON ↔ TOML Converter moves configuration between the two formats without guessing. JSON objects become TOML tables, arrays of objects become arrays of tables written as [[name]] blocks, and plain values are written before sub-tables, which TOML requires: a key placed after a [table] header would otherwise belong to that table. For example {"package": {"name": "app"}, "bin": [{"name": "cli"}]} becomes a [package] table and a [[bin]] entry. In the other direction a full TOML 1.0 parser reads basic, literal and multi-line strings, hexadecimal, octal and binary integers with underscores, floats, booleans, inline tables, dotted keys and all four date-time forms. Dates and times are returned as strings because JSON has no date type, and integers too large for JavaScript are kept as strings so no digits are lost. The most common mistakes are reported with their line and column: defining the same key or table twice, reopening an inline table, extending a table created with dotted keys, unquoted string values and trailing commas inside inline tables. TOML has no null, so JSON that contains null is rejected with the path of the offending value instead of silently dropping it. Comments are not part of the data model and are not carried over to JSON. This makes the tool handy for Cargo.toml, pyproject.toml, netlify.toml and Hugo configs. Conversion happens entirely in your browser.
How to Use
- Paste JSON or TOML and choose the direction.
- Fix any error shown with its line and column.
- Copy or download the result.
Frequently Asked Questions
What happens to null values?
TOML has no null type, so the converter stops and names the path of the null value. Remove the key or replace the value, then convert again.
How are TOML dates converted to JSON?
Offset date-times, local date-times, local dates and local times are copied as strings exactly as written, for example "1979-05-27T07:32:00-08:00".
Are comments kept?
No. Comments are not part of TOML data, so they cannot be represented in JSON. Use the TOML formatter if you only want to tidy a file and keep its comments.
Does it run offline?
Yes. Parsing and conversion run in your browser; nothing is uploaded.
Related Tools
Validate TOML 1.0 with exact line and column errors and tidy its layout while keeping every comment.
Pretty print, minify, and validate JSON.
Convert between YAML and JSON formats.
Convert JSON to XML and XML back to JSON, with attributes, repeated elements and CDATA handled.
Convert .env files to JSON or YAML and back, with quoting, multi-line values, nesting and variable expansion.
Convert between HEX, RGB, and HSL formats.