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.
How to Use
- 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.
- 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.
- 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.
- 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.
- 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.
- The top-level JSON value must be an object when converting to TOML. Wrap root arrays or primitive values in { ... } first.
- 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.
- Looking for YAML or other data formats? Browse the Developer Tools category for related converters.
- 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.
Related Tools
Data Format Converter
Pick a data format for each box and convert between any two of JSON, YAML, TOML, INI, .env, properties, CSV, and XML, such as application.properties to YAML, .env to JSON, or CSV to XML. Anything lost along the way is flagged one by one, all in your browser.
JSON to YAML Converter
Paste into either box to convert JSON to YAML or YAML back to JSON. Big numbers stay exact, and every lost detail gets its own warning.
JSON to CSV Converter
Paste text or open a file in either box to convert between a JSON array and CSV. Nested fields are flattened with a warning, and downloaded CSV gets a BOM so Excel shows non-English text correctly.
JSON to XML Converter
Paste text or open a file in either box to turn legacy XML into JSON or JSON into valid XML with a declaration, with clear rules for attributes, text, and repeated elements.
JSON Formatter
Paste one long line of JSON and get it neatly laid out at once. Pick 2-space, 4-space, or tab indentation, or minify it to one line, sort keys, and check the syntax. Big numbers stay exact, and formatting never changes a value.
Unicode Escape Encoder & Decoder
Type in either box to turn text into \uXXXX, \u{…}, &#x…;, or U+XXXX, or decode any mix of Unicode escapes back into text.
Base64 Encoder & Decoder
Type in either box to encode text as Base64 or decode Base64 back into text. UTF-8 safe, with a URL-safe alphabet option.
URL Encoder & Decoder
Type in either box to percent-encode text for a URL, or decode %20-style sequences back into readable text.