Tools

JSON → TOML

Convert JSON data to TOML format.

JSON
Ln:1 Col:1
TOML

About JSON to TOML Conversion

TOML (Tom's Obvious, Minimal Language) is increasingly popular as a configuration format, used by Rust's Cargo, Python's pyproject.toml, Hugo static site generator, and many other modern tools. Converting JSON to TOML is useful when setting up new projects, migrating configuration files, or when you prefer TOML's readable syntax with comments over JSON's strict format.

JSON to TOML Mapping

JSON objects become TOML tables with [section] headers. Top-level string, number, and boolean values are written as simple key-value pairs. JSON arrays of primitives become TOML arrays. JSON arrays of objects become TOML array of tables ([[section]]). Nested objects create dotted section headers like [parent.child].

Important differences: TOML supports comments (# comment) which JSON does not. TOML null values are converted to empty strings since TOML has no null type. TOML natively supports date/time types, but JSON dates stored as strings remain as quoted strings. TOML's flat table syntax can make deeply nested JSON structures more readable.

Frequently Asked Questions

How is JSON null handled in TOML?
TOML has no null type. JSON null values are converted to empty strings (""). If you need to represent absence of a value, consider removing the key entirely from the TOML output.
Can all JSON structures be represented in TOML?
Most JSON structures convert cleanly. However, TOML requires the top-level value to be a table (object). JSON arrays at the root level or primitive root values cannot be directly represented in TOML.
How are nested JSON objects handled?
Nested objects become TOML sections with dotted headers. For example, {"servers": {"alpha": {"ip": "10.0.0.1"}}} becomes [servers.alpha] with ip = "10.0.0.1" underneath.