TOML v1.0 · Cargo / pyproject ready

Convert JSON to readable TOML

Objects become tables, arrays of objects become array-tables. Perfect for pyproject.toml, Cargo.toml, and any TOML-configured tool.

JSON → TOML Workspace
Input size
238 B
9 lines
Output size
194 B
21 lines
Style
[tables]
TOML v1.0
Status
Valid
Cargo / pyproject
input · json
output · toml
title = "TryDevTools"

[owner]
name = "Ada"
since = 2024


[db]
host = "localhost"
port = 5432
tls = true


[[servers]]
name = "alpha"
ip = "10.0.0.1"


[[servers]]
name = "beta"
ip = "10.0.0.2"
Quick Start

How to convert JSON to TOML

TOML is the config format of choice for modern Python (pyproject.toml), Rust (Cargo.toml), and many CLI tools. This converter maps JSON cleanly to TOML's table and array-table syntax.

  1. 01

    Paste a JSON object

    Top-level must be an object — TOML doesn't allow array roots.

    Inputs parse through the native JSON.parse reviver chain — strict RFC 8259. Any syntax error returns line and column for the exact offending byte.

    root: objectRFC 8259JSON.parsestrictlive
    input · raw.json · RFC 8259
    {"title":"Demo"}
    loaded · parsed RFC 8259RFC 8259 · ready
  2. 02

    Nested → tables

    Each nested object becomes a [table] header. Arrays of objects become [[array-table]] sections.

    Indent options run through JSON.stringify(value, null, n); the second argument lets you sort, transform, or omit keys via a replacer if you ever wire one in.

    [table][[array]]indentJSON.stringifylive
    output · options.toml · live
    title = "Demo"
    
    [db]
    host = "localhost"
    options applied · livelive
  3. 03

    Inline tables for mixed shapes

    Arrays of mixed types (or non-object arrays) become inline values. Strings escape per JSON, keys quote when non-bare.

    Large documents stream through a useMemo with stable hashing so options re-apply instantly — no full re-parse if only formatting changes.

    inlinesafe-quotingmemoisedinstantdiff-friendly
    inline · renderedvalues · ready
    tags = ["a","b"]
    rendered · livediff-friendly
  4. 04

    Copy or download .toml

    Drop into your project. Works with all major TOML parsers.

    Download is a Blob with application/json; copy uses the Async Clipboard API. Both round-trip identically to what the page rendered.

    pyprojectCargoclipboardblob.json
    export · copiedready · done
    ✓ Copied
    ✓ Saved
    shipped · ready to shipsuccess
Pro tips

Production-grade JSON, the right way

Stick to RFC 8259

Strict JSON has no NaN, Infinity, comments, or trailing commas. If you need those, look at JSON5 or JSON Repair.

Preserve key order for diffs

JavaScript preserves insertion order, but two parsers shouldn’t be assumed equal. Use Sort JSON Keys before diffing or hashing.

Big integers lose precision

JS numbers lose precision past 2^53−1. Transport large IDs as strings or use BigInt.

Escape inside HTML

When inlining JSON inside <script>, escape </ to <\/ so HTML parsing doesn’t close your tag early.

Validate at boundaries

Trust the wire as little as possible. Run incoming JSON through a schema (Zod / Pydantic) before it touches business logic.

Minify in production

Minify removes whitespace; gzip removes redundancy. Together they typically shrink JSON payloads 70–85% over the wire.

Use Cases

When to convert JSON to TOML

Anywhere modern config tooling expects TOML.

pyproject.toml

Python projects (Poetry, PDM, hatch, uv, ruff, mypy) configure via TOML. Output round-trips losslessly through JSON.parse + JSON.stringify, so the file you save is byte-identical to what you see. Streaming parsers, jq pipelines, and Postgres jsonb columns all accept the result without complaint.

10× faster to scan

Cargo.toml

Rust crate manifests are TOML. Pairs perfectly with sort-keys + diff for review-friendly fixtures in CI. Whitespace-only churn disappears and reviewers see real changes, which keeps PR comments focused on logic rather than indentation.

cleaner PR diffs

CLI config

Many CLI tools (ripgrep, starship, helix) take TOML configs.

RFC 8259 valid

Static site config

Hugo and Zola sites use TOML for site config.

round-trip safe

Plugin manifests

Editor and CLI plugin systems often standardize on TOML.

schema-friendly

Migrating from JSON

Moving a project's config from JSON to TOML for human-friendliness. Output is byte-stable: same input plus same options always produces identical bytes, ideal for content-addressed caches and snapshot tests. Downloads ship with the application/json MIME so editors apply syntax highlighting.

production-ready
FAQ

Frequently asked questions

TOML's spec doesn't allow an array at the top level. Wrap arrays inside a key if you need a flat list.
Each object becomes an [[array-table]] section, the canonical TOML pattern for repeated structured records.
ISO-8601 strings are kept as strings — TOML's date types are not auto-detected. Edit by hand if needed.
Mixed-type or scalar arrays become inline arrays: tags = ["a", "b", 1].
No. All conversion runs locally.
Suggest a tool

Something missing?

Tell us what you need. We ship the top requests every two weeks.

Sent straight to the maintainers · no account needed
47 in queue·8 shipped this month
Request queued. Thanks!