JSON to TOML Converter – Convert JSON to TOML Free Online

Use the free JSON to TOML Converter below: your data never leaves your browser — all work happens on your device, and nothing is uploaded to any server.

Convert JSON to TOML, the Config File Format

TOML is the configuration format used by Rust projects, Python packaging, and many developer tools. It is designed to be read by humans: keys and values on plain lines, sections in square brackets, and arrays of tables in double brackets. JSON, by contrast, is designed to be read by machines, with braces and quotes everywhere. When you have data in JSON and need it as a config file, converting by hand means rewriting every line and rethinking every nested object. This tool does the translation for you.

Paste a JSON object and press Convert. Simple values become key and value lines at the top. Nested objects become sections with headers in square brackets. Arrays of objects become arrays of tables, with double-bracket headers, one per item. Arrays of simple values stay on one line. The output is a TOML document you can save with a .toml extension and use directly.

How the Translation Works

The rules follow the shape of TOML itself. A JSON object maps to a TOML table. A key whose value is a string, number, or boolean becomes a line like title equals “My App”. A key whose value is an object becomes a section header like [database], followed by that object’s lines. A key whose value is an array of objects becomes a series of [[servers]] sections, one for each item, each holding that item’s lines.

Order matters in TOML: all plain key lines must appear before the first section header. The tool emits the document in that order automatically, so the output parses without rearrangement. Nested sections get dotted headers, which keeps the hierarchy clear.

Strings are quoted with double quotes, numbers keep their form, and booleans become lowercase true and false, as TOML requires. Arrays of simple values are written inline, with items separated by commas.

The Null Problem, Handled Honestly

TOML has no null value. JSON does. When a JSON document contains null, there is no faithful TOML translation for that field, and any tool must make a choice. This tool skips null fields and lists them in a comment at the top of the output, so you can see exactly what was left out and decide what to do about it.

Your options for a skipped field depend on why it was null. If the field is optional, deleting it is correct, and the comment simply confirms the deletion. If the field needs a value, replace it with an appropriate default: an empty string, a zero, or false, depending on what the setting means. If the field is a placeholder for a value that arrives later, add it back by hand once you know the value. The comment makes sure none of these decisions happen silently.

The Engine Behind the Tool

The conversion uses the smol-toml library, loaded from a public CDN, when it is available. smol-toml is a small, focused TOML implementation that handles the stringify step according to the TOML specification. If the library cannot load, for example because the CDN is blocked on your network, the tool falls back to a built-in serializer that produces the same structure for ordinary documents. The output tells you which engine ran, so there is no mystery about where the result came from.

For most documents the two engines agree. If your document is unusual, prefer the library result and test the output with a TOML parser in your own toolchain before shipping it.

Where TOML Conversion Is Useful

Migrating configuration is the main use. A tool that exports settings as JSON, or an API that returns settings as JSON, produces data that a TOML-based project cannot read directly. Converting it here gives you a config file in the format the project expects, with sections and tables already in place. From there, small edits adapt it to the project’s exact schema.

Writing documentation is the second use. An example configuration shown as TOML is far easier to read than the same data as JSON, because the section headers act as headings and the values sit on clean lines. If you document a tool’s settings, convert a sample JSON export to TOML and use the result as your example. Readers will thank you.

Seeding a new project is the third use. If you already have the same settings in JSON from another system, converting them gives you a complete starting config file, and you only adjust the values that differ.

Tips and Limits

Top-level input must be a JSON object. TOML documents are tables, so an array or a bare value at the top level has no direct TOML form. If your JSON is an array, wrap it in an object under a meaningful key first, and the array becomes a table or an array of tables under that key.

Keys with unusual characters are quoted in the output, since TOML bare keys allow only letters, digits, underscores, and dashes. Dates need a note too: JSON has no date type, so a date string stays a string in TOML unless you rewrite it as a TOML date by hand.

Privacy

All conversion happens in your browser. Your JSON never leaves your device, is never stored, and is never sent to a server. The tool is free and needs no account.

Related tools

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top