JSON to TOML Converter

Paste text or open a file in either box to convert between JSON and TOML (including pyproject.toml and Cargo.toml), with per-path warnings for any lost details.

Indent

How to Use

  1. Paste JSON into the top box to get TOML below, or paste pyproject.toml, Cargo.toml, or any TOML into the bottom box to get JSON above. No direction switch needed.
  2. You can also click “Choose a file” or drop a file (up to 5 MB) into either box. Files ending in .json, .jsonc, or .json5 go into the JSON box, and .toml files go into the TOML box automatically. Non-UTF-8 files fall back to Windows-1252 on English pages, and you can switch the encoding manually.
  3. Each box has a “Download” button that saves with LF line endings. Opened files keep their original base name with a .json or .toml extension; pasted text downloads as data.json or data.toml.
  4. Choose 2 spaces, 4 spaces, Tab, or Minify for indentation—this applies to the JSON output only, since TOML uses table headers for structure. Turn on “Sort keys” to sort object keys alphabetically while preserving array order.
  5. Whenever data changes or cannot be represented directly—such as omitted null values, integers outside signed 64-bit range, TOML dates/times turned into strings, or stripped comments—a warning lists every affected path.
  6. The top-level JSON value must be an object when converting to TOML. Wrap root arrays or primitive values in { ... } first.
  7. Syntax errors highlight the exact line and column, quote the source line with a ^ marker, and keep the other box's last valid output intact.
  8. Looking for YAML or other data formats? Browse the Developer Tools category for related converters.
  9. For other pairs, such as YAML to TOML or CSV to XML, use the Data Format Converter: pick any two of JSON, YAML, TOML, INI, .env, properties, CSV, and XML for its two boxes. You'll find it in the related tools below this page.

FAQ

Why did null values from my JSON disappear in the TOML output?

The TOML specification has no null type—every key and array element must hold a concrete value. When converting JSON to TOML, null object fields and null array items are omitted and each affected path is reported in the warnings below the output. If the target app expects an entry, replace null with an empty string or another fallback value.

Which file extensions and text encodings are supported, and how are download names chosen?

Files up to 5 MB are supported. .json, .jsonc, and .json5 files route to the JSON box, and .toml files route to the TOML box; unrecognized extensions stay in the box you chose with a notice. Files are read strictly as UTF-8 (stripping any BOM) first, falling back to Windows-1252 on English pages, with a selector to re-read as UTF-8, Big5, Shift_JIS, or Windows-1252. Downloads keep your original filename with .json or .toml, or default to data.json / data.toml.

Why does converting a root JSON array or single value to TOML fail?

Every TOML document has a table (object) at its root, so a bare array, string, number, or boolean cannot be serialized directly as a valid TOML file. Wrap it in an object such as {"items": [...]} and convert again.

How are integers over 64 bits, datetimes, and comments handled?

TOML integers are limited to signed 64-bit values (up to 9223372036854775807), so larger JSON integers are converted to strings with a warning to preserve every digit. TOML dates and times have no native JSON type and become ISO strings with a warning. Comments cannot survive parsing and trigger a warning too.

Does it handle [[...]] arrays of tables in pyproject.toml and Cargo.toml?

Yes. TOML [[bin]] or [[products]] sections become JSON arrays of objects, and JSON arrays of objects convert back into [[...]] arrays of tables automatically.