DevTools Logo

TOML to JSON

TOML to JSON

Convert TOML config into indented JSON, with exact integers and clear error locations.

Runs in your browser
Try an example

TOML input

JSON output

Paste TOML to see JSON

Conversion runs locally; nothing is uploaded.

Details

TOML to JSON parses TOML 0.5 and most TOML 1.0 syntax — tables, arrays of tables, dotted keys, inline tables, dates and multiline strings — and emits indented JSON. Integers beyond 2^53 are written as exact decimal digits with a warning that JavaScript's JSON.parse will round them; date-times become ISO strings because JSON has no date type; inf and nan become null. Invalid input such as duplicate keys or impossible calendar dates gets a line-and-column diagnostic instead of a silent correction. Everything runs locally.

More examples

Package manifest

[package]
name = "devtools"
version = "1.0.0"
tags = ["tools", "web"]

Tables become JSON objects and TOML arrays become JSON arrays; the output is indented two spaces by default.

Dates and large integers

released = 1979-05-27T07:32:00Z
id = 9223372036854775807

The date becomes an ISO string and the 64-bit integer stays exact in the text, with warnings explaining both mappings.

Duplicate key

name = "a"
name = "b"

TOML forbids duplicate keys, so conversion is blocked with the offending position while the input is preserved for editing.

    Examples

    Manifest

    Input
    [package]
    name = "devtools"
    version = "1.0.0"
    tags = ["tools", "web"]
    Output
    {
      "package": {
        "name": "devtools",
        "version": "1.0.0",
        "tags": ["tools", "web"]
      }
    }

    A table header becomes an object and the TOML array becomes a JSON array.

    Lossy values

    Input
    released = 1979-05-27T07:32:00Z
    id = 9223372036854775807
    score = nan
    Output
    {
      "released": "1979-05-27T07:32:00.000Z",
      "id": 9223372036854775807,
      "score": null
    }

    The date becomes a string, the integer keeps all digits and nan becomes null; each mapping is warned about.

    About this tool

    TOML to JSON turns configuration written in TOML into indented JSON you can paste into an API payload, a fixture or another tool. The converter runs entirely in your browser and implements the TOML value grammar directly, with no parser dependency and no upload.

    It understands tables, arrays of tables, dotted keys, inline tables, multiline strings, dates and signed 64-bit integers. Invalid input produces a line-and-column diagnostic rather than a silent repair, and every mapping JSON cannot represent exactly is called out in a warning.

    What this tool does not do

    • The parser covers TOML 0.5 and the common TOML 1.0 grammar, not experimental extensions.
    • Offset date-times are normalised to UTC; the original offset is not kept in the JSON string.
    • Integers beyond 2^53 stay exact in the text but lose precision when JavaScript parses them.
    • TOML requires a table at the root, so a bare array document is rejected.

    How to use this tool

    1. Paste or upload TOML

      Type into the input panel, use the File action, or choose one of the example chips.

    2. Read the diagnostics

      Errors show the offending line and column; warnings explain dates, big integers and inf/nan.

    3. Copy the JSON

      Copy the result or download converted.json.

    4. Fix in place

      Your original TOML is never replaced, so you can edit the failing line and watch the result update.

    Use cases

    Config migration

    Move a Cargo, Poetry or app config into a JSON pipeline without hand-editing keys.

    Test fixtures

    Keep readable TOML in docs and generate JSON fixtures for JavaScript test runners.

    API payloads

    Paste a TOML example into a JSON request body while keeping the source readable.

    How TOML values map to JSON

    TOMLJSON
    string, booleanstring, boolean
    integernumber
    floatnumber
    date / date-timestring
    inf / nannull
    [table] / [[array of tables]]object / array of objects

    A comment-only or empty document converts to an empty JSON object.

    Common mistakes

    Mistake:Assuming a date-time stays a typed date.

    Fix:JSON has no date type. Parse the ISO string into a Date in the consumer if you need one.

    Mistake:Trusting large integers after JSON.parse.

    Fix:The JSON text is exact, but JavaScript rounds above 2^53. Quote such identifiers in TOML.

    Mistake:Expecting duplicate keys to be last-wins.

    Fix:TOML rejects duplicates. The tool reports the second definition instead of choosing one.

    Frequently asked questions

    Does this upload my TOML file?

    No. The parser, converter and diagnostics all run in your browser tab. There is no network request, account or storage.

    Why is a TOML date a string in the JSON?

    JSON has no date type. Date, time and date-time values are written as ISO-style strings, and offset date-times are normalised to UTC. A warning explains the mapping.

    Why do I see a warning for a large integer?

    The JSON text keeps the exact 64-bit digits, but JavaScript's JSON.parse rounds values above 2^53. Quote identifiers that need to survive as strings.

    What happens to inf and nan?

    They become null because JSON cannot express them. The warning lets you decide whether to represent them as strings instead.

    Why was my conversion blocked?

    TOML forbids duplicate keys, duplicate table headers, impossible dates and integers outside the signed 64-bit range. The tool shows the exact line and column so you can fix the source.

    References & standards