b2KIT

TOML to JSON Converter

Convert TOML configuration files to JSON format with validation and proper type handling.

Tested tool guide Tested browser tools Checked August 16, 2026

What TOML to JSON Converter does, with a checked example

Paste a TOML document and this page returns the equivalent JSON, parsed value by value. Strings, booleans, integers, floats, arrays, and tables map onto JSON counterparts; comments, table headers, and digit separators disappear; a syntax error or a duplicate key stops the conversion rather than producing partial output. The surprises sit at the type edges: TOML datetimes such as 1979-05-27T07:32:00Z have no JSON equivalent and come out as strings, hexadecimal or underscored integers (0xFF, 1_000_000) are computed to their decimal value, and float values like inf and nan cannot be represented in JSON at all.

Worked example

A concrete input and expected output from the current implementation.

Input

title = "Backup config"
version = 1_000_000
[storage]
path = "/var/backups"
retention = 30
created = 2026-08-16T09:30:00Z
[storage.cleanup]
enabled = true

Expected output

{
  "title": "Backup config",
  "version": 1000000,
  "storage": {
    "path": "/var/backups",
    "retention": 30,
    "created": "2026-08-16T09:30:00Z",
    "cleanup": {
      "enabled": true
    }
  }
}

The underscore in 1_000_000 is TOML's digit separator, removed during parsing, so the integer comes out as 1000000. The offset datetime has no JSON type, so it is emitted as its RFC 3339 string form, and the header [storage.cleanup] nests one object inside the other.

How the result is produced

1

Validation before output

The whole document is checked against the TOML grammar before anything is returned. Malformed syntax, duplicate keys, and redefinitions of the same table stop the conversion with the error reported, because TOML forbids defining a key more than once. This is the validation in the tool's name: a file that converts here is one a TOML parser will also accept.

2

How each type is mapped

Basic, literal, and multiline strings all become JSON strings. Integers and floats become JSON numbers, with hex, octal, binary, and underscore forms evaluated to their value first. Booleans map directly. Arrays stay arrays, and TOML's mixed-type arrays are legal JSON too. Tables and arrays of tables become objects and arrays of objects, and datetimes become strings in RFC 3339 form because JSON defines no date type.

Good uses

  • Your configs ship as TOML (Cargo.toml, pyproject.toml, a homegrown .toml) but the consumer - a script, template, or web frontend - only accepts JSON.
  • You suspect a TOML file is malformed or redefines a key; pasting it here gives a parse verdict instead of letting the problem surface silently downstream.
  • A TOML file full of dotted keys and [[array-of-tables]] headers is hard to picture; the JSON view shows the resolved nesting with comments stripped.

Limits and checks

  • [object Object]
  • [object Object]
  • [object Object]

Common questions

Will my datetime values stay dates in the JSON?

No. JSON defines strings, numbers, booleans, arrays, objects, and null, but no date type, so every TOML datetime - offset, local, date-only, or time-only - is emitted as a string in RFC 3339 form, such as "2026-08-16T09:30:00Z". Any program reading the output must parse that string itself; the tool guarantees the text format, not a date object.

What happens if the TOML has a syntax error or a duplicate key?

The conversion refuses to run and reports the problem instead of returning partial or guessed output. TOML forbids defining the same key twice, including once as a table header and once as a plain assignment, so duplicates are flagged. Fix the file and paste it again; a document that converts here is valid TOML.

References and verification

The example and behavioral notes were checked against the browser implementation. Standards and primary references below define the relevant format, formula, or platform behavior.

Related Tools