toml to json converter

typetools

instant, client-side type converter • 0ms network latency

root:
inputtoml
paste or drop file
225 chars
outputjson
*.json
{
  "title": "TypeTools Compiler Config",
  "version": 2,
  "enabled": true,
  "server": {
    "host": "127.0.0.1",
    "port": 8080,
    "timeout_ms": 50
  },
  "features": {
    "strict_nulls": true,
    "infer_optional": true,
    "targets": [
      "typescript",
      "zod",
      "pydantic",
      "rust"
    ]
  }
}
0.15ms•in-browser
documentation, edge cases & specifications below

step-by-step integration guide

technical specification differences & end-to-end conversion workflow

Lexical Structure of TOML v1.0 vs. Hierarchical JSON Objects

Tom's Obvious Minimal Language (TOML v1.0) is the standard configuration format for Rust's Cargo package manager (Cargo.toml), Python's modern packaging standard (pyproject.toml), and Cloudflare Workers (wrangler.toml). Unlike JSON, which requires deeply nested curly braces to represent hierarchy, TOML flattens nesting using table headers ([package.metadata]), dotted keys (server.host = "127.0.0.1"), inline tables ({ version = "1.0", optional = true }), and double-bracketed Arrays of Tables ([[bin]]). Additionally, TOML supports first-class RFC 3339 offset date-times, local dates, hex/octal/binary integer literals (0xdeadbeef, 0b1101), and underscore numeric separators (1_000_000)—none of which are valid syntax in raw JSON.

Table Path Expansion and Scalar Normalization

Our TOML-to-JSON parser processes TOML v1.0 documents into a unified JSON syntax tree inside a local Web Worker. First, the lexer strips comments and normalizes TOML-specific numeric literals—converting underscored numbers, binary, octal, and hexadecimal integers into standard base-10 JSON numbers. Second, dotted keys (e.g., a.b.c = 1) and table headers ([a.b]) are recursively expanded into nested JSON objects, detecting and reporting any duplicate key redefinitions. Third, double-bracketed Array of Tables blocks ([[plugins]]) are accumulated sequentially into a JSON array under the target path, and RFC 3339 native TOML dates are serialized into ISO-8601 string literals.

frequently asked questions

common developer questions answered

q:How are TOML Arrays of Tables ([[products]]) converted into JSON?

Each [[table_name]] section appends a new JSON object element to an array located at that key path, converting repeated [[products]] blocks into "products": [ {...}, {...} ].

q:What happens to TOML dotted keys like 'database.connection.port = 5432'?

Dotted keys are expanded into nested JSON objects: { "database": { "connection": { "port": 5432 } } }, merging seamlessly with any sibling [database] table sections.

q:How does the converter handle TOML underscore numbers (1_000_000) and hex literals (0xff)?

Because JSON only permits base-10 numeric literals without visual separators, the parser evaluates 1_000_000 to 1000000 and 0xff to 255 before emitting JSON.

topic cluster

related type & ast converters

3 interconnected tools