Skip to content

JSON to TOML

Turn a JSON object into a TOML document with proper tables and arrays of tables.

Quick Tool Overview

The JSON to TOML converter writes nested objects as [table] headers and arrays of objects as [[table]] blocks, with every scalar key placed above the first header beneath it so the scoping is correct.

What it does
Converts a JSON object into a TOML document
You give it
A JSON object — TOML documents are tables
You get back
TOML with proper tables and arrays of tables
Best for
Writing Cargo, Python packaging and site configs
Developer Tools Free, unlimited use No sign-up Runs in your browser

About the JSON to TOML

TOML is what Rust, Python packaging and a growing number of tools expect for configuration, and hand-translating a JSON config into it is fiddly. This converter does the structural work: nested objects become [table] headers, arrays of objects become [[table]] blocks.

The ordering rule is applied automatically. Every scalar key in a section is written before the first table header beneath it, because TOML would otherwise read it as belonging to that table. Strings are quoted and escaped, multi-line strings use the triple-quote form, arrays of scalars stay inline, and keys that are not bare-safe get quoted. The root must be an object, since a TOML document is a table.

Key features of the JSON to TOML

Correct key ordering

Scalars are written before the first table header in their section, because TOML would otherwise read them as part of that table.

Arrays of tables

A list of objects becomes a repeated [[header]] block, which is the only TOML form for structured entries.

Inline where it reads better

Arrays of scalars stay on one line rather than being expanded into something harder to read.

Keys quoted when needed

A key that is not bare-safe is quoted automatically, so the output always parses.

Multi-line strings

A value containing line breaks uses the triple-quote form instead of a wall of escape sequences.

How to use the JSON to TOML

  1. 1

    Paste your JSON

    The root must be an object — a TOML document is a table.

  2. 2

    Review the tables

    Nested objects become [headers] and arrays of objects become [[headers]].

  3. 3

    Check the ordering

    Plain keys are written above the first table header, as TOML requires.

  4. 4

    Copy the TOML

    Ready to paste into Cargo.toml, pyproject.toml or your own config.

Frequently asked questions

A TOML document is a table by definition, so there is nowhere for a bare array or string to live at the top level. Wrap the value in an object with a named key.

Reviews of the JSON to TOML

What people who use the JSON to TOML think of it. Reviews come from visitors and are posted as written.

No ratings yet

Yours would be the first.

  • 5 0 reviews rated 5 stars
  • 4 0 reviews rated 4 stars
  • 3 0 reviews rated 3 stars
  • 2 0 reviews rated 2 stars
  • 1 0 reviews rated 1 star

Write a review

Used this tool? Your rating helps the next person decide.

Your rating

Plain text only — links, email addresses and HTML are not accepted. Your name and review are shown publicly; nothing else is collected. See the privacy policy.

0 reviews

Newest first

No reviews yet

Be the first to rate the JSON to TOML. It takes half a minute and no account.

Write the first review

More developer tools