JSON to TOML Converter Online

Paste any JSON object and emit clean, idiomatic TOML — sections, dotted keys, array-of-tables, datetimes. 100% in your browser.

What is a JSON to TOML converter?

A JSON to TOML converter takes a JSON object and emits the equivalent TOML document. Nested objects become [section] headers, deep paths become dotted keys, arrays of objects become [[array.of.tables]], and ISO date strings become unquoted TOML datetimes — exactly the format Cargo, Poetry, Hugo, and other TOML-first tools expect.

JSON is great for APIs, but it's a poor fit for hand-edited config files: no comments, no datetime type, and no concept of sections. TOML was designed to fix those gaps. This tool gives you a quick path from a JSON config snippet (often easier to generate or copy from documentation) to a TOML file you can drop straight into Cargo.toml, pyproject.toml, or config.toml.

How to convert JSON to TOML — 4 steps

  1. Paste JSON. Drop your JSON object into the input panel. Click Load Sample for a realistic config example.
  2. Click Convert. The tool walks the JSON tree, splits nested objects into sections, and emits idiomatic TOML.
  3. Review the output. Verify [section] headers, dotted keys, datetimes, and array-of-tables match your expectations.
  4. Copy the TOML. Paste straight into Cargo.toml, pyproject.toml, or any TOML-based configuration file.

Sample input and output

JSON

{
  "title": "Example",
  "owner": { "name": "Tom" },
  "database": {
    "enabled": true,
    "ports": [8000, 8001]
  }
}

TOML

title = "Example"

[owner]
name = "Tom"

[database]
enabled = true
ports = [8000, 8001]

Section-Aware

Nested objects become [section] headers, deep paths become dotted keys, and arrays of objects become idiomatic [[array.of.tables]] blocks.

Datetime Detection

ISO-8601 strings emit as TOML datetimes (unquoted). Plain strings stay quoted. Numbers and booleans are emitted bare.

Client-Side Only

Conversion runs in JavaScript on your machine. Tokens, secrets, or proprietary configuration never leave the browser.

Common use cases

  • check_circleAuthoring a Cargo.toml from a JSON snippet generated by a script
  • check_circleMigrating a JSON config file (e.g. tsconfig-style) to TOML for a Rust or Python project
  • check_circleGenerating pyproject.toml metadata blocks from a JSON template
  • check_circleConverting Hugo or Zola JSON front-matter to TOML front-matter
  • check_circleTranslating JSON-based service definitions to TOML for tools that prefer it
  • check_circleProducing example TOML snippets for blog posts, README files, or documentation
  • check_circleRound-tripping config between TOML-first and JSON-first tooling
  • check_circleQuickly previewing what a JSON object would look like as TOML

JSON vs TOML — quick comparison

JSON is strict, terse, and machine-friendly — perfect for APIs but painful for humans (no comments, no trailing commas, no datetime type). TOML is its inverse: explicit, quote-light, comment-friendly, and section-based, optimised for hand-edited configuration. The conversion is mostly mechanical, but the structural choices TOML offers (sections vs inline tables, array-of-tables vs inline arrays) can make a TOML file dramatically more readable than the equivalent JSON. The converter picks the idiomatic form by default: nested objects expand to sections, while small arrays of scalars stay inline.

Need to do more with TOML or JSON?

Convert, validate, and format with the rest of the OpenFormatter toolkit — all browser-side.

Frequently Asked Questions

What is TOML?

TOML (Tom’s Obvious Minimal Language) is a configuration file format designed to be easy for humans to read due to obvious semantics. It maps unambiguously to a hash table and is the default for Cargo (Rust), Poetry/PEP 621 (Python), Hugo, and many other tools.

How does TOML compare to YAML and JSON?

JSON is strict and verbose, ideal for APIs but painful to hand-edit. YAML is forgiving and visual but its whitespace rules are a frequent source of bugs. TOML sits between the two: explicit syntax (no whitespace traps), but quote-light and section-based, which makes config files genuinely pleasant to edit.

Can I use this to author a Cargo.toml from JSON?

Yes. Convert your JSON object to TOML, then paste into Cargo.toml. Common Cargo fields like [package], [dependencies], and [[bin]] map cleanly: nested objects become [section] headers and arrays of objects become [[array.of.tables]].

Are nested objects supported?

Yes. Nested objects emit as [parent.child] section headers using dotted keys. Arrays containing only objects emit as [[parent.child]] array-of-tables, which is the idiomatic TOML way to represent a list of structured records.

How are dates and times handled?

JSON has no date type, so dates are typically strings. The converter detects ISO-8601 patterns (e.g. 1979-05-27T07:32:00-08:00) and emits them as TOML datetimes (unquoted). Strings that aren’t valid ISO dates stay as quoted strings.

What about arrays of mixed types?

TOML 1.0 allows arrays with mixed types. The converter emits them inline using [a, b, c] syntax. Arrays of objects use the array-of-tables form, while arrays of scalars or arrays-of-arrays stay inline.

Is my JSON sent to your servers?

No. Conversion runs in JavaScript inside your browser. Open DevTools → Network and confirm — no requests are made when you click Convert.

Will the round-trip JSON → TOML → JSON be lossless?

For most data: yes. The two edge cases to watch are (1) numeric precision — JSON does not distinguish int from float, but TOML does, and (2) date strings — a string that happens to look like an ISO date will round-trip as a TOML datetime, not a string.

JSON to TOML Converter Online — Free JSON to TOML Tool