TOML to JSON Converter Online

Paste any TOML file — Cargo.toml, pyproject.toml, config — and emit clean, pretty JSON. 100% in your browser.

What is a TOML to JSON converter?

A TOML to JSON converter parses a TOML document and emits the equivalent JSON tree. Sections become nested objects, dotted keys collapse into deep paths, arrays of tables become arrays of objects, and datetimes are preserved as ISO-8601 strings. The result is JSON you can pipe into jq, feed to a Node script, or store anywhere TOML isn't a first-class citizen.

TOML powers the manifest of nearly every Rust project (Cargo.toml) and the modern Python packaging stack (pyproject.toml via PEP 518/621). Converting to JSON is the fastest way to plug those manifests into JavaScript-based tooling — bundlers, monorepo scripts, GitHub Actions, or generic templating engines.

How to convert TOML to JSON — 4 steps

  1. Paste TOML. Drop your .toml file into the input panel, or click Load Sample for a Cargo-style example.
  2. Click Convert. The parser walks sections, dotted keys, and array-of-tables, building a JSON tree.
  3. Inspect the JSON. Verify nested objects match the original [section] layout. Warnings flag any unusual constructs.
  4. Copy the output. Pipe it into jq, store in a package.json, or feed into any tool that wants JSON.

Sample input and output

TOML

[package]
name = "demo"
version = "0.1.0"

[dependencies]
serde = "1.0"

JSON

{
  "package": {
    "name": "demo",
    "version": "0.1.0"
  },
  "dependencies": {
    "serde": "1.0"
  }
}

Pretty JSON Output

JSON is emitted with two-space indentation, ready to drop into a config file, a script fixture, or a documentation snippet.

Spec-Aware Parsing

Handles tables, array-of-tables, inline tables, dotted keys, basic and literal strings, hex/octal/binary integers, and underscored numbers.

Client-Side Only

Parsing runs in JavaScript on your machine. Cargo.toml registry tokens, private dependency URLs, and proprietary config never leave the browser.

Common use cases

  • check_circleExtracting fields from Cargo.toml using jq after converting to JSON
  • check_circleReading pyproject.toml metadata in a Node-based monorepo script
  • check_circleMigrating a TOML-based config to a JSON-driven system (e.g. JSON Schema validation)
  • check_circlePretty-printing TOML in a JSON-friendly viewer for review
  • check_circleGenerating documentation from TOML manifests using JSON templating
  • check_circleComparing TOML files structurally by diffing the JSON output
  • check_circleFeeding TOML into GitHub Actions workflows that expect JSON via fromJson()
  • check_circleRound-tripping config between TOML-first and JSON-first tooling

Notes on the inline parser

The converter ships an embedded TOML parser — no external library, no upload. It implements the common 80%: [tables], [[array of tables]], dotted keys, basic and literal strings, integers (decimal/hex/octal/binary, with underscores), floats, booleans, RFC3339 datetimes (kept as ISO strings), arrays, and inline tables. Where a corner case isn't supported (e.g. multi-line basic strings, mixed-element heterogeneous arrays in unusual nesting), the parser emits a warning and keeps the raw text, so the JSON is still useful for inspection.

Need to do more with TOML?

Validate, convert back, or format TOML with the rest of the OpenFormatter toolkit.

Frequently Asked Questions

Why convert TOML to JSON?

JSON is the universal interchange format for tools, scripts, and pipelines. Converting Cargo.toml or pyproject.toml to JSON makes it trivial to extract fields with jq, feed into a JavaScript build script, or pipe into a tool that doesn’t natively understand TOML.

What does the parser support?

The parser handles the common 80%: basic and literal strings, integers, floats, booleans, RFC3339 datetimes (kept as strings), arrays, inline tables, [tables], [[array of tables]], dotted keys, hex/octal/binary integers, and underscored numbers. For corner cases (multi-line strings, mixed-type arrays in unusual positions) the tool emits a warning and keeps the raw value.

Are dates preserved?

Yes. JSON has no native datetime type, so RFC3339 datetime values are preserved as ISO-8601 strings (e.g. "2024-01-15T10:30:00Z"). When you round-trip back to TOML using our JSON to TOML tool, the ISO format is detected and re-emitted as a datetime.

What about TOML date-time edge cases?

TOML 1.0 has four datetime variants: offset date-time, local date-time, local date, and local time. The parser keeps each as a string in its source format, which preserves precision and timezone information without forcing a JavaScript Date object (which would lose timezone fidelity).

Does it handle Cargo.toml correctly?

Yes — Cargo.toml is the canonical TOML file, and all of its features (sections, dependency inline tables, [[bin]] arrays of tables, profile sub-sections) parse cleanly. Try the Load Sample button to see a Cargo-style file converted.

Why might I see a warning?

Warnings appear when the parser encounters something outside the supported subset: multi-line basic/literal strings, very unusual array nesting, or values it cannot classify. The output JSON still contains the parsed structure — the warning just flags places to double-check.

Is my TOML uploaded?

No. The parser is plain JavaScript that runs in your browser. Open DevTools → Network and confirm — no requests are sent when you click Convert. Cargo.toml files often contain private registry tokens, so this matters.

How does dotted-key syntax convert?

Dotted keys like a.b.c = 1 are converted to nested JSON: { "a": { "b": { "c": 1 } } }. Quoted segments (e.g. "weird.key") become single string keys, not nested levels.

TOML to JSON Converter Online — Free TOML to JSON Tool