Skip to content

JSON to TOML Converter

Convert JSON objects to TOML format with type preservation and clean table structure output.

JSON to TOML Converter tool

Loading...

Example

Input: {"title":"App","server":{"host":"localhost","port":8080}}

Result: title = "App" / (blank line) / [server] / host = "localhost" / port = 8080

Top-level values become key = value lines and each nested object becomes a [table] section. Strings are quoted and numbers keep their type.

How JSON Maps to TOML

JSONTOML
{"a":"x"}a = "x"
{"n":8080}n = 8080
{"f":1.0}f = 1
{"b":true}b = true
{"arr":[1,2]}arr = [ 1, 2 ]
{"s":{"k":1}}[s] then k = 1
{"s":{"t":{"k":1}}}[s.t] then k = 1
{"items":[{"n":1},{"n":2}]}[[items]] n = 1, then [[items]] n = 2
{"x":null,"y":1}y = 1 (x is dropped)
{"first name":"A"}"first name" = "A"

Output of this converter; "then" marks a new line.

  1. Paste your JSON object into the input area on the left side.
  2. The converter validates the JSON and maps nested objects to TOML table sections automatically.
  3. Review the generated TOML output with proper [table.headers] and key-value pairs in the right panel.
  4. Check that arrays of objects are correctly represented using [[double.bracket]] syntax.
  5. Click the copy button to copy the TOML output for use in your Cargo.toml, pyproject.toml, or other config file.

JSON to TOML: Tables, Arrays and Types

This converter rewrites a JSON object as TOML, the config format behind Cargo.toml in Rust and pyproject.toml in Python. Top-level values become key = value lines, and each nested object becomes a [table] section.

TOML (Tom's Obvious, Minimal Language) looks like an INI file with real data types. Strings are always quoted, while numbers and booleans are not. Nesting is shown with section headers instead of indentation, so {"server":{"tls":{"on":true}}} becomes a [server.tls] header followed by on = true. An array of objects becomes an array of tables, with one [[items]] header per entry.

Some JSON has no TOML form, so watch for a few things. The root must be an object; a top-level array or a plain value gives an error. TOML has no null, so keys whose value is null are left out, and an array that contains null cannot be converted at all. Whole-number floats such as 1.0 are written as 1, which TOML reads as an integer. Keys with spaces or other special characters are quoted, as in "first name" = "A".

Plain values are always written before any [table] section, because in TOML every key after a header belongs to that table. The panels work both ways, so you can paste TOML on the right to get JSON back. To move config straight between TOML and YAML, use the TOML to YAML Converter.

Sources

Frequently Asked Questions

TOML is a config file format designed to be easy for people to read and hard to get wrong. It is best known as the format of Cargo.toml in Rust and pyproject.toml in Python, and it is also used by tools such as Hugo, Deno, Poetry and many command-line apps.
TOML has no null type, so any key whose value is null is left out of the output. If the key matters to your program, give it a real value in the JSON first, such as an empty string, 0 or false. An array that contains null cannot be written at all and shows an error.
A TOML document is always a table of keys at the top level, so it cannot start with a list or a single value. Wrap the array in an object, such as {"items": [...]}, and it converts to a series of [[items]] tables.
They mark an array of tables. Each [[items]] header starts a new entry in a list called items, and the keys below it belong to that entry. It is how TOML writes what JSON calls an array of objects, such as a list of dependencies or servers.
TOML requires plain values to come before any [table] header, since everything after a header belongs to that table. So the converter writes simple keys first and nested objects after them, as sections. The data is the same; only the layout moved.

Related Tools

TOML to JSON Converter

Parse TOML documents and convert to formatted JSON output with validation and error reporting.

Developer Tools

JSON Formatter and Validator

Format, validate, beautify, and minify JSON data with a collapsible tree view and line-and-column error detection.

Developer Tools

JSON to YAML Converter

Convert JSON documents to YAML format with syntax validation, clean formatting, and instant preview.

Developer Tools

TOML to YAML Converter

Convert TOML configuration files to YAML format seamlessly with structure preservation.

Developer Tools

JSON to XML Converter

Convert JSON data to well-formed XML documents with customizable root element and formatting options.

Developer Tools

JSON to CSV Converter

Convert a JSON array of objects to CSV with automatic column headers, and convert CSV back to JSON in the same tool.

Developer Tools