Skip to content

TOML to JSON Converter

Paste TOML, get JSON instantly in your browser. Cargo.toml, pyproject.toml & config.toml ready. Dates and nested tables handled right. 100% private, no upload.

No Tracking Runs in Browser Free
Options · 2 spaces
Indent
0 chars
JSON Output
0 lines
Reviewed for TOML 1.0.0 spec compliance, date-time fidelity, and safe large-integer handling — Go Tools Engineering Team · Jul 2, 2026

What is TOML and Why Convert to JSON?

TOML (Tom's Obvious, Minimal Language) is a configuration file format created by Tom Preston-Werner to be unambiguous, easy for humans to read, and trivially mappable to a hash table. It has become the default configuration format for the Rust ecosystem (Cargo.toml), modern Python packaging (pyproject.toml, standardized in PEP 518 and PEP 621), and tools like Hugo, Netlify, Poetry, and Foundry. JSON, by contrast, is the universal machine-interchange format — every language parses it, every API speaks it. Converting TOML to JSON is therefore a common task: you author configuration in readable TOML, then convert to JSON to feed a program, inspect it with JSON tooling, or diff it in a pipeline.

This tool has several differentiators that matter for correctness:

**1. Date-time fidelity.** TOML has first-class date and time types — offset date-time, local date-time, local date, and local time — that JSON lacks entirely. Naive converters flatten all of them into ISO timestamps, so a local date like 1979-05-27 becomes 1979-05-27T00:00:00Z, silently inventing a time and a timezone. This tool preserves the exact TOML kind: local dates stay calendar dates, local times stay times, and only offset date-times carry a timezone. That keeps your data honest and round-trips lossless.

**2. Full TOML 1.0.0 support.** Nested tables, dotted keys, inline tables, and arrays of tables ([[section]]) are all parsed correctly according to the TOML 1.0.0 specification using the zero-dependency smol-toml library. Real Cargo.toml and pyproject.toml files with mixed inline and standard tables convert exactly as the spec requires.

**3. Honest large-integer handling.** TOML integers are 64-bit, but browser JavaScript can only hold integers up to 2^53 - 1 exactly. Rather than silently corrupting a large value or crashing, this tool converts to the nearest JSON number and warns you, so you can choose to store the value as a string instead. This honesty about a fundamental browser limitation is something most converters gloss over.

**4. 100% browser-based privacy.** Your TOML — which may contain registry tokens, internal package sources, or deployment secrets — never leaves your browser. No upload, no server, no logging. You can confirm this in your browser's Network tab.

Need the reverse? Use the JSON to TOML Converter. Converting between other config formats? Try the JSON to YAML Converter and YAML to JSON Converter, or validate and pretty-print your JSON output first with the JSON Formatter. TOML, JSON, and YAML each have their place: TOML for human-edited application config, JSON for machine interchange, and YAML for deeply nested infrastructure manifests. This converter lets you move between the first two without a single line of code.

// Convert TOML to JSON in Node.js using the smol-toml library
import { parse } from 'smol-toml';

const toml = `
[package]
name = "my-app"
version = "1.0.0"

[dependencies]
serde = { version = "1.0", features = ["derive"] }
`;

const data = parse(toml);
const json = JSON.stringify(data, null, 2);

console.log(json);
// {
//   "package": { "name": "my-app", "version": "1.0.0" },
//   "dependencies": {
//     "serde": { "version": "1.0", "features": ["derive"] }
//   }
// }

Key Features

Live Conversion

JSON output updates instantly as you type or paste TOML — no Convert button needed. Large inputs (>200KB) automatically switch to manual mode to keep the browser responsive.

Date-Time Fidelity

TOML offset date-times, local date-times, local dates, and local times are converted to JSON strings that preserve the original kind — no fabricated midnight timestamps, so round-trips stay lossless.

Full TOML 1.0.0 Support

Nested tables, dotted keys, inline tables, and arrays of tables ([[section]]) are all parsed correctly via the zero-dependency smol-toml engine, matching the TOML 1.0.0 spec.

Cargo.toml & pyproject.toml Ready

Optimized for the most common real-world TOML files — Rust manifests and Python packaging configs — including inline tables and arrays of tables. Load an example to see the exact JSON structure.

Honest Large-Integer Warnings

Integers beyond JavaScript's safe range (2^53) can't be represented exactly in JSON — the tool converts them to the nearest number and warns you, instead of silently corrupting the value.

100% Browser-Based Privacy

All parsing runs locally in your browser. Your TOML — including registry tokens, private package sources, and deployment secrets — is never uploaded, stored, or logged.

Examples

Cargo.toml (Rust)

[package]
name = "my-app"
version = "1.0.0"
edition = "2021"
authors = ["Jane Doe <jane@example.com>"]

[dependencies]
serde = { version = "1.0", features = ["derive"] }
tokio = { version = "1", features = ["full"] }

[dev-dependencies]
criterion = "0.5"

[[bin]]
name = "my-app"
path = "src/main.rs"

Convert a Rust Cargo.toml manifest to JSON — useful for tooling, dependency dashboards, or feeding cargo metadata into scripts that expect JSON.

pyproject.toml (Python)

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "my-package"
version = "0.3.1"
requires-python = ">=3.10"
dependencies = [
  "requests>=2.31",
  "pydantic>=2.0"
]

[project.optional-dependencies]
dev = ["pytest>=8.0", "ruff>=0.4"]

[tool.ruff]
line-length = 100

Convert a PEP 621 pyproject.toml to JSON to inspect project metadata, dependencies, and tool config programmatically.

netlify.toml

[build]
command = "npm run build"
publish = "dist"

[build.environment]
NODE_VERSION = "20"

[[redirects]]
from = "/old-path"
to = "/new-path"
status = 301
force = true

[[headers]]
for = "/*"

[headers.values]
X-Frame-Options = "DENY"

Convert a Netlify build config to JSON to audit redirects and headers or generate the equivalent config for another platform.

Hugo config.toml

baseURL = "https://example.org"
languageCode = "en-us"
title = "My Hugo Site"
theme = "ananke"

[params]
description = "A static site built with Hugo"
mainSections = ["posts", "docs"]

[[menu.main]]
name = "Blog"
url = "/posts/"
weight = 1

[[menu.main]]
name = "About"
url = "/about/"
weight = 2

Convert a Hugo site config.toml to JSON to migrate settings, diff configuration, or drive a config UI.

rustfmt.toml

edition = "2021"
max_width = 100
hard_tabs = false
tab_spaces = 4
newline_style = "Unix"
use_small_heuristics = "Default"
reorder_imports = true
reorder_modules = true

Convert a flat rustfmt.toml to JSON — a good example of how top-level key-value pairs (no tables) map directly to a JSON object.

App config with dates & arrays of tables

title = "Deployment Log"
last_deployed = 1979-05-27T07:32:00Z
release_date = 1979-05-27
maintenance_window = 02:00:00

[[servers]]
name = "alpha"
ip = "10.0.0.1"
ports = [8001, 8002]

[[servers]]
name = "beta"
ip = "10.0.0.2"
ports = [9001]

Showcase how TOML native date-times (offset date-time, local date, local time) and arrays of tables convert cleanly to JSON strings and arrays.

How to Use

  1. 1

    Paste Your TOML

    Enter or paste your TOML into the input field above. You can also click 'Load example' to try a real Cargo.toml, pyproject.toml, or deployment config.

  2. 2

    See Live JSON Output

    JSON appears instantly in the output panel. Adjust the Indent option (2 or 4 spaces) to match your target format. Dates, tables, and arrays of tables are handled automatically.

  3. 3

    Copy or Download

    Click Copy to grab the JSON to your clipboard, or Download to save it as a .json file ready for your program, API, or tooling.

Common TOML Pitfalls

Unquoted String Values

In TOML, string values must be quoted. A bare word on the right of an equals sign is only valid for booleans (true/false), numbers, dates, or as part of an array. Quote your strings with double or single quotes.

✗ Wrong
name = my-app
✓ Correct
name = "my-app"

Duplicate Keys

TOML forbids defining the same key twice within the same table, and forbids redefining a table that was already defined. This is a common error when merging config fragments. Each key and table must be unique.

✗ Wrong
name = "a"
name = "b"
✓ Correct
name = "a"
alt_name = "b"

Invalid Date-Time Format

TOML date-times follow RFC 3339. A date needs a full 4-digit year, 2-digit month, and 2-digit day; a date-time needs a T (or space) separator. Malformed dates fail to parse.

✗ Wrong
released = 2026-7-2
✓ Correct
released = 2026-07-02

Missing Closing Bracket

Arrays, inline tables, and table headers must be closed. An unclosed [ or { produces a parse error pointing at the line and column where the problem was detected.

✗ Wrong
ports = [8001, 8002
✓ Correct
ports = [8001, 8002]

Integer Beyond Safe Range

TOML integers are 64-bit, but JSON numbers in the browser are limited to 2^53 - 1. Values beyond that are rounded during conversion and a warning is shown. Store very large integers as quoted strings to keep them exact.

✗ Wrong
snowflake = 1420070400000000000
✓ Correct
snowflake = "1420070400000000000"

Redefining a Table

Once a table like [servers] is defined, you cannot open it again with the same header. To have multiple entries, use an array of tables ([[servers]]) instead, which becomes a JSON array of objects.

✗ Wrong
[servers]
name = "a"
[servers]
name = "b"
✓ Correct
[[servers]]
name = "a"
[[servers]]
name = "b"

Common Use Cases

Rust Cargo Metadata
Convert Cargo.toml to JSON to build dependency dashboards, audit crate versions and features, or feed manifest data into scripts and CI that expect JSON rather than TOML.
Python Project Config
Convert pyproject.toml to JSON to inspect PEP 621 project metadata, extract dependency lists, or drive tooling that reads packaging configuration programmatically.
Deployment Config Inspection
Convert netlify.toml, foundry.toml, or other platform configs to JSON to audit redirects, headers, and build settings, or to generate equivalent config for a different platform.
Config Format Migration
Convert TOML application config to JSON when moving to a system that prefers JSON, or as an intermediate step before transforming further with JSON tooling like jq.
Static Site Settings
Convert Hugo config.toml to JSON to migrate site settings, diff configuration across environments, or build a settings UI backed by JSON.
API and Script Input
Turn human-authored TOML into JSON that a REST API, serverless function, or automation script can consume directly, bridging readable config and machine input.

Technical Details

TOML 1.0.0 Parsing via smol-toml
TOML is parsed with the smol-toml library, a zero-dependency, fully TOML 1.0.0-compliant parser. It correctly handles nested tables, dotted keys, inline tables, arrays of tables, multi-line strings, and all four date-time types, and it reports parse errors with line and column positions.
Lossless Date-Time and Safe Integer Handling
TOML date-times are serialized to JSON strings that preserve their exact kind (offset date-time, local date-time, local date, local time). Integers beyond JavaScript's safe range (2^53 - 1) are promoted to BigInt during parsing, then converted to the nearest JSON number with a precision warning, so valid TOML never fails to convert.
100% Browser-Based — No Upload, No Server
All processing happens in your browser's JavaScript engine. No data is transmitted at any point. Inputs larger than 200KB switch from live to manual mode (an explicit Convert click) to keep the interface responsive.

Best Practices

Store Very Large Integers as Strings
If your TOML has integers beyond 2^53 - 1 (Snowflake IDs, nanosecond timestamps, large counters), quote them as strings before converting. JSON numbers in the browser cannot hold them exactly, and the tool will warn you when it has to round.
Prefer 2-Space Indent for JSON Output
Two-space indentation is the most widely used convention for JSON and produces clean, readable output that plays well with most formatters and diff tools. Reserve 4-space indent for when a style guide requires it.
Validate the JSON Output Before Using It
After converting, if you plan to hand-edit the JSON or feed it somewhere strict, run it through our JSON Formatter to confirm it is valid and consistently formatted.
Keep TOML Comments Separately
JSON has no comment syntax, so TOML # comments are dropped on conversion. If the comments are important documentation, keep the original TOML in version control alongside the generated JSON.
Use Arrays of Tables for Repeated Sections
When you have multiple similar sections (servers, redirects, bins), write them as arrays of tables ([[section]]) rather than repeating [section]. They convert to a clean JSON array of objects instead of causing a duplicate-table error.

Frequently Asked Questions

How do I convert TOML to JSON online?
Paste your TOML into the input field above. The tool parses it and produces JSON instantly in your browser — no button click needed. You can switch the JSON indentation between 2 and 4 spaces in the Options panel. Once the JSON appears in the output area, click Copy to grab it to your clipboard or Download to save it as a .json file. Everything runs locally, so your TOML never leaves your device.
What is TOML and why convert it to JSON?
TOML (Tom's Obvious, Minimal Language) is a configuration file format designed to be easy for humans to read and write, with clear semantics that map unambiguously to a hash table. It powers Rust's Cargo.toml, Python's pyproject.toml, Hugo, Netlify, and many other tools. You convert TOML to JSON when you need to feed configuration into a program or API that expects JSON, inspect a config file programmatically, diff two configs with JSON tooling, or drive a UI. TOML is written by humans; JSON is consumed by machines — this converter bridges the two.
How are TOML dates and times represented in JSON?
JSON has no native date type, so TOML date-times are converted to strings. This tool preserves the exact TOML date kind: an offset date-time like 1979-05-27T07:32:00Z becomes "1979-05-27T07:32:00.000Z", a local date like 1979-05-27 stays "1979-05-27" (it is not padded into a full timestamp), and a local time like 07:32:00 becomes "07:32:00.000". Many converters incorrectly flatten local dates into midnight UTC timestamps — this one keeps the original meaning so round-trips are lossless.
Does this tool handle Cargo.toml and pyproject.toml?
Yes. Cargo.toml and pyproject.toml are the two most common real-world TOML files, and both are fully supported, including nested tables ([dependencies], [tool.ruff]), inline tables (serde = { version = "1.0", features = ["derive"] }), and arrays of tables ([[bin]]). Load the Cargo.toml or pyproject.toml example above to see the exact JSON structure produced. This is handy for build dashboards, dependency audits, or any script that reads project metadata as JSON.
How are TOML tables and arrays of tables converted?
A TOML table header like [owner] becomes a nested JSON object under the key "owner". A dotted table like [tool.ruff] becomes nested objects: { "tool": { "ruff": { ... } } }. An array of tables written with double brackets — [[servers]] repeated — becomes a JSON array of objects: { "servers": [ { ... }, { ... } ] }. Inline tables ({ a = 1, b = 2 }) become plain JSON objects. The conversion follows the TOML 1.0.0 specification exactly.
What happens to very large integers when converting TOML to JSON?
TOML supports 64-bit signed integers, but JavaScript (and therefore JSON in the browser) can only represent integers exactly up to 2^53 - 1 (9007199254740991). If your TOML contains an integer larger than that — for example a Snowflake ID or a nanosecond timestamp — it cannot be represented losslessly as a JSON number, and the value is rounded, with a warning shown. This is a fundamental limitation of browser JavaScript that affects every browser-based converter. For exact preservation, keep such values as quoted strings in your TOML.
Is my TOML data sent to any server?
No. All parsing and conversion happen entirely in your browser using JavaScript. Your TOML is never uploaded, never stored, and never logged. This makes the tool safe for Cargo.toml files with private registry tokens, pyproject.toml with internal package indexes, deployment configs with secrets, and any other sensitive configuration. You can verify this by opening your browser's Network tab — pasting TOML triggers zero network requests.
Can I convert JSON back to TOML?
Yes. Use the companion JSON to TOML Converter for the reverse direction, or click the Swap direction button at the top of this tool to flip the input and output in place. Note that JSON to TOML has a few constraints TOML to JSON does not — the top level must be an object, and null values have no TOML equivalent — which the JSON to TOML tool explains and handles for you.
How do I convert TOML to JSON on the command line?
A popular option is the Rust-based CLI 'toml' or the Go tool 'yj' (yj -tj reads TOML and writes JSON). With Python 3.11+ you can run: python3 -c "import tomllib, json, sys; print(json.dumps(tomllib.load(sys.stdin.buffer)))" < config.toml. With Node.js: npx smol-toml (or a small script using the smol-toml library). For a quick one-off in the browser without installing anything, this tool is the fastest path.
How do I convert TOML to JSON in Python, Rust, or Node.js?
In Python 3.11+: import tomllib, json; data = tomllib.load(open('config.toml','rb')); json.dump(data, open('config.json','w')). In Rust: use the toml and serde_json crates — let value: toml::Value = toml::from_str(&text)?; let json = serde_json::to_string_pretty(&value)?. In Node.js: import { parse } from 'smol-toml'; const data = parse(text); const json = JSON.stringify(data, null, 2) — this is the same library and approach used by this tool.
Does the converter preserve key order, and what about comments?
Key order within a table is preserved: keys appear in the JSON output in the same order they appear in your TOML. Comments, however, are dropped — JSON has no comment syntax, so TOML # comments cannot survive the conversion. If you need to keep documentation, add it as a JSON-friendly field or keep the original TOML alongside the generated JSON.
Is there a file size limit for TOML input?
There is no hard limit, but inputs over 200KB switch from live conversion to manual mode: a Convert button appears and conversion runs only when you click it, keeping the browser responsive. Typical config files — even large Cargo.toml workspaces or multi-environment deployment configs — convert in well under 50 milliseconds.

Related Tools

View all tools →