TOML to JSON Converter
Convert TOML configuration to JSON instantly with this free online tool. Supports nested tables, arrays of tables, inline tables, multi-line strings, and offers pretty/compact/sorted output styles, structure visualization, line-aware error messages, and one-click samples.
Your ad blocker is preventing us from showing ads
MiniWebtool is free because of ads. If this tool helped you, please support us by going Premium (ad‑free + faster tools), or allowlist MiniWebtool.com and reload.
- Allow ads for MiniWebtool.com, then reload
- Or upgrade to Premium (ad‑free)
About TOML to JSON Converter
Welcome to the TOML to JSON Converter, a free online tool that turns any TOML configuration into clean, valid JSON in a single click. Whether you are migrating Cargo.toml to a JSON-based pipeline, debugging deeply nested settings visually, or feeding a TOML file into a service that only accepts JSON, this converter handles every TOML construct correctly: tables, sub-tables, arrays of tables, inline tables, dotted keys, multi-line strings, hex/octal/binary integers, dates, and special floats. Pick the output style that fits your workflow — pretty 2-space, pretty 4-space, compact, or sorted-by-key — and inspect the result through a structure tree, a stats dashboard, and a transformation diagram.
What is TOML and Why Convert It to JSON?
TOML (Tom's Obvious Minimal Language) is a configuration format designed to be unambiguous and easy for humans to read. It powers package metadata for Cargo (Rust), Poetry (Python), and many other developer tools. JSON, on the other hand, is the universal data interchange format on the web. Many systems — REST APIs, document databases, browser localStorage, and JavaScript apps — only speak JSON. Converting TOML to JSON lets you bridge these two worlds without rewriting your config.
Common Reasons to Convert TOML to JSON
- Pipe TOML into a JSON-only API — for example, a deployment service or a feature-flag platform.
- Inspect deeply nested config visually — JSON's bracket-and-brace structure makes hierarchy obvious at a glance.
- Generate front-end config bundles — keep your authoring format in TOML, ship JSON to the browser.
- Work with linters and JSON Schema — validate TOML structure by routing it through a JSON Schema validator.
- Compare configurations — diff sorted-key JSON between environments to spot drift.
- Migrate legacy config — gradually port a TOML file into a JSON-backed config service.
Key Features of This Converter
- Full TOML 1.0 coverage — basic and literal strings (single and multi-line), integers in decimal/hex/octal/binary with underscore separators, floats with scientific notation,
inf,-inf,nan, booleans, dates and datetimes. - Nested structures — tables, sub-tables (
[a.b.c]), arrays of tables ([[a]]), inline tables ({ a = 1, b = 2 }), and dotted keys. - Four output styles — pretty 2-space, pretty 4-space, compact (minified), and sorted keys for diff-friendly output.
- Visual structure tree — see how TOML constructs become JSON objects and arrays, with type badges (table, AoT, array, string, number, bool).
- Statistics dashboard — count of tables, keys, arrays, arrays of tables, depth, plus input/output character counts.
- Line-aware error messages — every parsing error includes the exact line number so you can fix it instantly.
- One-click sample library — load Cargo.toml-style, pyproject-style, application-config, numbers, or multi-line-string examples.
- Copy and download — copy JSON to clipboard or download as a
.jsonfile. - Mobile responsive — works comfortably on phones, tablets, and desktop.
- No data leaves your browser request — TOML is parsed server-side and the result is returned in the same response; nothing is stored.
How TOML Maps to JSON
Most TOML constructs have a clean, lossless JSON equivalent. Here is the mapping the converter applies:
| TOML construct | JSON equivalent | Notes |
|---|---|---|
key = "string" | "key": "string" | Basic strings keep escape sequences; literal strings are verbatim. |
key = 42 | "key": 42 | Decimal, hex (0x), octal (0o), and binary (0b) integers all become JSON numbers. |
key = 3.14 | "key": 3.14 | Floats keep their precision; inf/nan become null for valid JSON. |
key = true | "key": true | Booleans map directly. |
key = 2026-04-25T12:00:00Z | "key": "2026-04-25T12:00:00Z" | JSON has no datetime type, so the RFC 3339 string is preserved. |
key = [1, 2, 3] | "key": [1, 2, 3] | Arrays become JSON arrays. |
[table] | "table": { "k": 1 } | Tables become objects. |
[a.b.c] | "a": { "b": { "c": { "k": 1 } } } | Sub-tables nest implicitly. |
[[items]] | "items": [{ "k": 1 }] | Array of tables becomes an array of objects. |
k = { a = 1, b = 2 } | "k": { "a": 1, "b": 2 } | Inline tables are equivalent to JSON objects. |
a.b.c = 1 | "a": { "b": { "c": 1 } } | Dotted keys create implicit nesting. |
Examples
title = "App" [server] host = "localhost" port = 8080
{
"title": "App",
"server": {
"host": "localhost",
"port": 8080
}
}
[[user]] name = "Alice" admin = true [[user]] name = "Bob" admin = false
{
"user": [
{ "name": "Alice", "admin": true },
{ "name": "Bob", "admin": false }
]
}
db.host = "10.0.0.1"
db.port = 5432
db.options = { ssl = true, pool = 20 }
{
"db": {
"host": "10.0.0.1",
"port": 5432,
"options": { "ssl": true, "pool": 20 }
}
}
How to Use the TOML to JSON Converter
- Paste your TOML into the input box, or click a Quick Sample chip to load a typical configuration.
- Choose an output style — pretty 2-space (default), pretty 4-space, compact, or sorted keys.
- Click Convert to JSON. The tool parses the TOML and renders the JSON output with statistics and a structure tree.
- Inspect the result — review the stats dashboard for an at-a-glance summary, expand the structure tree to see the hierarchy, and read the conversion diagram to understand the mapping.
- Copy or download the JSON. The Copy button puts it on your clipboard; Download saves it as
converted.json.
TOML Features Supported
Strings
- Basic strings use double quotes and support escape sequences:
\n,\t,\r,\",\\,\uXXXX,\UXXXXXXXX. - Literal strings use single quotes and contain raw characters with no escapes.
- Multi-line basic strings use triple double quotes (
""") and support line-ending backslash to trim whitespace. - Multi-line literal strings use triple single quotes (
''') and preserve everything verbatim.
Numbers
- Decimal integers with optional underscore separators:
1_000_000. - Hex/octal/binary integers:
0xDEADBEEF,0o755,0b1010. - Floats with optional sign, decimal, and exponent:
3.14,-2e-3,6.022e23. - Special floats:
inf,-inf,nan(converted to JSONnull).
Tables and Arrays
- Tables:
[name]opens a new table. - Sub-tables:
[a.b.c]creates nested tables. - Arrays of tables:
[[name]]appends a new table to an array. - Inline tables:
{ a = 1, b = 2 }. - Arrays:
[1, 2, 3]can span multiple lines and contain mixed value types.
Choosing the Right Output Style
- Pretty 2-space — the default. Compact yet readable; ideal for most uses including config files committed to git.
- Pretty 4-space — matches PEP-8 style indentation; preferred by some Python and Java teams.
- Compact (minified) — single line, no extra whitespace; smallest payload for transmission over the network.
- Sorted keys — pretty output with keys sorted alphabetically. Excellent for diffs because identical configs always produce byte-identical output regardless of key order.
Frequently Asked Questions
What is TOML and why convert it to JSON?
TOML is a config format designed to be obvious and minimal. Converting it to JSON lets you feed configurations into JSON-only systems, debug nested structure visually, share with web APIs, and integrate with JavaScript code that expects JSON.
Does this converter handle arrays of tables and inline tables?
Yes. The converter fully supports the [[array.of.tables]] syntax (translated to JSON arrays of objects), inline tables like { a = 1, b = 2 } (translated to JSON objects), nested sub-tables, dotted keys, and arbitrary nesting depth.
What output styles are supported?
Four styles: Pretty 2-space (the default, ideal for reading), Pretty 4-space (matches PEP-8 style indentation), Compact (minified single-line JSON, smallest size), and Sorted Keys (pretty output with keys sorted alphabetically for diff-friendliness).
How are TOML datetimes converted to JSON?
JSON has no native datetime type, so TOML datetimes (RFC 3339 format like 2026-04-25T12:00:00Z) are preserved as strings in the JSON output. Local dates, local times, and offset datetimes are all kept verbatim, ready to parse back with any datetime library.
What happens with TOML inf and nan values?
Standard JSON does not allow Infinity or NaN literals, so non-finite floats from TOML (inf, -inf, nan) are converted to null in the JSON output. This produces output that strictly conforms to RFC 8259 and parses correctly in every JSON library.
Where do parsing errors come from and how do I fix them?
The converter reports the exact line where parsing failed along with a description of the problem (unterminated string, duplicate key, missing equals sign, malformed array, etc.). Common causes are unbalanced quotes or brackets, mixing tabs in unexpected places, and accidentally redefining a table that was already defined earlier.
Is there a size limit?
The tool can handle TOML files several megabytes in size comfortably. For very large config files, performance is dominated by browser rendering, not parsing.
Is my TOML data sent anywhere or stored?
Your input is parsed server-side to produce the JSON output and then discarded. We do not log, store, or transmit your configuration anywhere else.
Can I convert JSON back to TOML?
This tool is one-way (TOML → JSON). For the reverse direction, use a JSON-to-TOML converter or a programming library like Python's tomli_w, JavaScript's @iarna/toml, or Rust's toml crate.
Tips for Clean Conversions
- Use sorted-key output for diffs — your version-controlled JSON will be stable across team members.
- Prefer multi-line strings (
"""or''') for paragraphs of text rather than concatenating with\nescapes. - Group related keys with tables — they are more readable than long dotted keys.
- Watch for accidental table redefinition — TOML disallows defining the same table twice; the converter catches this with a clear error.
- Keep dates and times in RFC 3339 — local-only formats also parse, but RFC 3339 round-trips cleanly through JSON consumers.
Additional Resources
Reference this content, page, or tool as:
"TOML to JSON Converter" at https://MiniWebtool.com/toml-to-json-converter/ from MiniWebtool, https://MiniWebtool.com/
by miniwebtool team. Updated: Apr 25, 2026
Related MiniWebtools:
Other Text Tools:
- Anagram Generator
- Bionic Reading Converter New
- Compare Two Strings Featured
- Find Longest Line
- AI Language Detector
- Text Line Processor
- XML Validator
- Text to Speech Reader New
- Text Column Extractor New
- JSON to YAML Converter New
- Regex Tester New
- Diff Checker New
- CSV to JSON Converter New
- Image to Base64 Converter New
- API Tester New
- ASCII Table Reference New
- Webhook Tester New
- AI Blog Title Generator New
- AI Hashtag Generator New
- AI Slogan Generator New
- AI Article Outline Generator New
- Online Notepad New
- TOML to JSON Converter New
- JSON to CSV Converter New
- XML to JSON Converter New
- SQL to MongoDB Query Converter New