JSON to TOML Converter

Converts JSON objects to TOML config syntax, or TOML back to JSON. Covers core TOML: scalars, arrays of primitives, and [table] headers. See the FAQ for what's deliberately out of scope.

Private by architecture: All processing is 100% client-side memory. Your data never leaves this browser tab.
JSON input
0 lines · 0 charsJSON
TOML output
Ctrl/Cmd+Shift+C
0 charsTOML

About This Tool

TOML is the config format behind Cargo.toml, pyproject.toml, and plenty of other tool configs, but data headed into one often starts life as JSON -- an API response, a generated config object, a .json settings file being migrated. This converts between the two for the core of the spec: scalars, arrays of primitives, and nested [table] sections.

It's a from-scratch parser and serializer, matching this site's existing hand-written YAML and CSV support rather than pulling in a dependency, so it's deliberately scoped -- see the FAQ for what's out. For YAML-based configs instead, use JSON to YAML.

Key Features

  • Bidirectional conversion: one Direction dropdown (or the ⇌ swap button) switches between JSON → TOML and TOML → JSON.
  • Nested [table] headers: nested JSON objects become dotted [a.b.c] table headers.
  • Arrays of primitives: strings, numbers, and booleans serialize to [1, 2, 3]-style TOML arrays.
  • Clear errors on unsupported constructs: dates, multi-line strings, inline tables, and arrays-of-tables raise a named error on TOML → JSON instead of corrupting data.
  • File upload: load a .json or .toml file directly.

Example

{
  "name": "demo-app",
  "version": 2,
  "server": { "host": "localhost", "port": 8080 }
}

produces:

name = "demo-app"
version = 2

[server]
host = "localhost"
port = 8080

Frequently Asked Questions

Which parts of TOML does this support?
The core: top-level key = value pairs (strings with basic escaping, integers, floats, booleans), arrays of those primitives, and [table] / [nested.table] headers for nested objects. That covers most hand-written config files like a basic Cargo.toml or pyproject.toml section.
What is explicitly NOT supported?
TOML dates/datetimes, multi-line strings ("""..."""), inline tables ({ a = 1 }), and arrays-of-tables ([[table]]). If TOML → JSON hits one of these, it raises a clear error naming the construct instead of silently producing wrong data.
Why no array-of-tables support?
This is a from-scratch, hand-written parser (matching this site's existing hand-written YAML and CSV parsers, with no added dependency), scoped deliberately to the constructs listed above. Arrays of tables add enough parsing complexity that getting them subtly wrong would be worse than refusing clearly.
Does converting JSON → TOML → JSON round-trip cleanly?
Yes, for anything within the supported scope: objects, strings, integers, floats, booleans, and arrays of those. null has no TOML equivalent and is rejected on the way out -- remove or replace null fields before converting.