JSON ↔ TOML Converter

Convert between JSON and TOML formats. Auto-converts as you type.

JSON
TOML

Get the JSON & API Cheat Sheet

Formatting tricks, jq commands, and common patterns — one page, zero fluff.

JSON to TOML Converter — Understanding the Formats

TOML (Tom's Obvious, Minimal Language) is a configuration file format designed to be easy for humans to read and write. Unlike JSON, TOML allows comments, has native date/time types, and its table syntax maps more naturally to configuration hierarchies. This JSON to TOML converter translates between the two formats bidirectionally, handling nested objects, arrays, strings, booleans, and numbers correctly.

TOML is the standard config format for Rust projects (Cargo.toml), Python packaging (pyproject.toml), the Hugo static site generator (hugo.toml), and tools like Ruff, uv, and Poetry. If you're working in any of these ecosystems, you'll encounter TOML regularly — and sometimes you'll need to convert config data you have in JSON into TOML, or extract TOML values into JSON for programmatic processing.

When comparing JSON vs TOML, the key differences are: TOML supports comments (JSON does not), TOML uses [section] table syntax instead of nested braces, TOML has native datetime types while JSON has only strings, and TOML arrays are typed (all elements must be the same type) while JSON arrays are heterogeneous. For pure configuration use cases, TOML is generally more pleasant to read and write by hand.

Converting JSON to TOML is most useful when you're scaffolding a new Rust, Python, or Hugo project and have configuration data in JSON form — from a template engine, an API response, or a script that generates config programmatically. The converter maps JSON objects to TOML sections, nested objects to dotted key sections, strings to quoted TOML strings, and booleans and numbers to their native TOML equivalents.

Converting TOML to JSON is useful when you need to process configuration data with languages or tools that have better JSON support than TOML. Most languages have a built-in JSON parser but require a third-party library for TOML — converting to JSON first can simplify your tooling. All processing runs entirely in your browser, so your configuration data (which may contain paths, URLs, or other sensitive values) never leaves your machine.

Conversion gotchas to be aware of: TOML arrays must contain elements of the same type, so mixed-type JSON arrays may not convert cleanly. TOML has a dedicated [[array of tables]] syntax for arrays of objects — check the output when converting complex nested arrays. TOML datetime values (like 2024-01-15T10:30:00Z) become strings in JSON since JSON has no native date type. And TOML comments are lost when converting to JSON, as JSON has no comment syntax.

Tips

  • TOML distinguishes between inline tables and standard tables — the converter uses standard tables for readability.
  • TOML has native date/time types. If your JSON has ISO 8601 date strings, they'll convert to TOML datetime values.
  • Nested objects in JSON become dotted key sections in TOML (e.g., [database.connection]).
  • TOML arrays of tables use [[array_name]] syntax — check the output carefully when converting complex nested arrays.