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.
Options · 2 spaces
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
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
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
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.
name = my-app
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.
name = "a" name = "b"
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.
released = 2026-7-2
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.
ports = [8001, 8002
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.
snowflake = 1420070400000000000
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.
[servers] name = "a" [servers] name = "b"
[[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?
What is TOML and why convert it to JSON?
How are TOML dates and times represented in JSON?
Does this tool handle Cargo.toml and pyproject.toml?
How are TOML tables and arrays of tables converted?
What happens to very large integers when converting TOML to JSON?
Is my TOML data sent to any server?
Can I convert JSON back to TOML?
How do I convert TOML to JSON on the command line?
How do I convert TOML to JSON in Python, Rust, or Node.js?
Does the converter preserve key order, and what about comments?
Is there a file size limit for TOML input?
Related Tools
View all tools →Base64 Decoder & Encoder
Encoding & Formatting
Decode and encode Base64 online for free. Real-time conversion with full UTF-8 and emoji support. 100% private — runs in your browser. No signup needed.
Base64 to Image Converter
Encoding & Formatting
Decode a Base64 string or data URI back into an image in your browser. Preview, read dimensions & MIME, then download as PNG, JPG, GIF, SVG. No upload.
CSV to JSON Converter
Encoding & Formatting
Convert CSV to JSON in your browser. RFC 4180, type inference, header row, big-int safe. 100% private, no upload.
.env to JSON Converter
Encoding & Formatting
Paste a .env file, get JSON instantly. Your database passwords, API keys and tokens never leave your browser — 100% private, no upload, free dotenv parser.
Free HTML Entity Decoder — Unescape HTML
Encoding & Formatting
Decode HTML entities and unescape HTML online — free, no signup, 100% in your browser. Converts named, decimal & hex references back to characters; never uploaded.
Free HTML Entity Encoder — Escape HTML
Encoding & Formatting
Encode HTML entities and escape special characters (< > & " ') online — free, no signup, 100% in your browser. Named, decimal, or hex output; never uploaded.