Skip to content

TOML to JSON converter

Paste TOML. Dates become strings and comments are dropped.

TOML datetimes become JSON strings. Local dates stay calendar dates, local times stay clock times, and offset datetimes keep their offset. Comments are not kept.

Ctrl+Enter or ⌘+Enter runs this tool immediately.

JSON output
TOML input
JSON output

Waiting for input.

Parsing stays in this browser. Input is not uploaded or saved.

How to use this tool

  1. Paste a TOML document or load the sample, which includes a table, an array, a date, and a multiline string.
  2. Choose readable or compact JSON. Dates are serialized as strings rather than being dropped.
  3. Read the notices under the status. Copy or download only when the conversion succeeds.

Supported formats and limitations

  • Supported syntax is TOML 1.1 as implemented by smol-toml. That includes arrays, inline and standard tables, and arrays of tables.
  • Offset datetimes, local datetimes, local dates, and local times all become JSON strings. JSON has no date type.
  • inf and nan are rejected. JSON cannot store them without turning them into null.
  • Integers outside ±(2^53 − 1) are rejected so they are not silently rounded.
  • Comments are discarded. A hash inside a quoted string is data and is kept.
  • Keys named __proto__ or constructor are rejected.

Examples

An array of tables

Repeated [[products]] tables become a JSON array of objects.

[[products]]
name = "Widget"

[[products]]
name = "Gadget"

A local date

A date without a time stays a calendar date string, not a UTC timestamp.

shipped = 2024-05-01

Common errors and solutions

Invalid TOML document
Check the quoted line and column. A missing value after = is a common cause.
Non-finite number
Replace inf or nan with a finite number or a quoted string.
Integer outside the safe range
Quote the integer if you need every digit, then convert again. The tool will not round it.

FAQ

Which TOML version is this?
The parser is smol-toml, which targets TOML 1.1.0. Behavior that differs from JSON is described on this page rather than hidden.
Why did my date gain milliseconds?
Offset and local times are formatted from the parsed time value, which has millisecond precision. A local date such as 2024-01-15 stays a date.
Are TOML files uploaded?
No. Parsing and conversion happen in your browser.

Read next

Related tools

  • TOML to YAML converter

    Convert TOML 1.1 configuration to YAML with 2-space or 4-space indentation. Dates become strings, comments are dropped, and invalid TOML produces no YAML.

  • JSON to TOML converter

    Convert a JSON object to TOML in the browser. Null values and mixed arrays are rejected, and invalid JSON produces no TOML.

  • TOML validator

    Check TOML 1.1 syntax without converting or rewriting it. Errors include a line and column when the parser provides them.