Skip to content
cosmodev ~/tools/toml-json-converter

TOML ⇄ JSON Converter

Converters & Formatters

Convert TOML to JSON and back. Tables, array-of-tables, and dotted keys round-trip; bare TOML dates stay date-only, datetimes become ISO-8601 strings. Swap carries the result into the input.

Try:

What it does

Converts TOML to JSON and JSON to TOML in one place. The TOML direction handles tables, array-of-tables ([[x]]), inline tables, and dotted keys, emitting pretty 2-space JSON; the JSON direction emits idiomatic TOML with nested [tables] and [[array-of-tables]] syntax. Swap flips direction and carries the result into the input for instant round-trips. Invalid input shows the parser’s error message. Everything runs locally in your browser.

How to use it

  1. Paste TOML (or JSON) into the input on the left — the header badge shows the current direction.
  2. The conversion appears live on the right. Copy takes it; Download saves converted.json or converted.toml.
  3. Swap exchanges sides and moves the output into the input.
  4. Copy share link encodes your input and direction in the URL.

Examples

Tap Sample (TOML direction):

[server] with host/port plus a [[peers]] array-of-tables → a JSON object whose peers key holds an array of objects.

The Cargo-style chip converts a Cargo.toml-shaped document — [package] and [dependencies] become nested JSON objects.

In the JSON direction, {"items":[{"n":1},{"n":2}]} becomes [[items]] blocks — one per element, keys inside.

Good to know

  • Bare TOML dates (2024-01-15) stay date-only strings in JSON; datetimes (2024-01-15T10:30:00Z) become full ISO-8601 strings with milliseconds.
  • Mixed-type arrays ([1, "two", true]) keep their order and types in JSON.
  • Numbers keep their TOML representations where possible; floats and integers stay distinct.
  • TOML has no null — JSON null values need removing before converting to TOML.
Source code2 languages
cosmodev ~/src/toml-json-converter

100% client-side · your data never leaves your browser. Found this useful? Share it with a teammate.