TOML Formatter & Converter
Format TOML and convert it to and from JSON instantly in your browser. Your data stays on your device.
Your TOML or JSON is parsed and converted locally in your browser and never uploaded, but avoid pasting real secrets or credentials from a config file into any tool.
Working with YAML configs too? Try the YAML ↔ JSON converter.
About TOML Formatter & Converter
This TOML formatter cleans up and validates TOML configuration as you type, and converts it both ways with JSON. Paste a Cargo.toml, pyproject.toml, or any config file to re-serialize it into clean, canonical TOML, or switch modes to turn TOML into pretty JSON and JSON back into TOML. Under the hood it uses a spec-compliant parser, so tables, arrays of tables, inline tables, dates, integers, floats, and booleans all round-trip correctly. When something is off, you get a clear inline error with the line and column instead of a silent failure, which makes it handy as a quick TOML validator. It is built for developers wiring up Rust, Python, or Go configs who want a fast toml to json check without a CLI. Everything runs entirely in your browser, so the config you paste is processed locally and never leaves your device.
Features
- Three modes: Format TOML, TOML to JSON, and JSON to TOML, switched with one click
- Reformats TOML into clean, canonical output with consistent key = value spacing
- Validates TOML as a side effect of formatting and flags errors with line and column
- Converts TOML to pretty-printed, syntax-highlighted JSON
- Converts a JSON object back into TOML, preserving tables, arrays, and scalar types
- Handles inline tables, arrays of tables, RFC 3339 dates, integers, floats, and booleans
- Live conversion as you type, with a Load example button to see a sample document
- Copy the result or download it as data.toml or data.json with one click
How to use the TOML Formatter & Converter
- Pick a mode: Format TOML, TOML → JSON, or JSON → TOML.
- Paste your TOML or JSON into the input box on the left.
- Read the formatted or converted output in the panel on the right.
- If the input is invalid, check the inline error for the line and column to fix.
- Click Copy to grab the result, or download it as a .toml or .json file.
Example
Input
[database]
enabled = true
ports = [ 8000, 8001, 8002 ]
[[servers]]
name = "alpha"
ip = "10.0.0.1"
Output
{
"database": {
"enabled": true,
"ports": [
8000,
8001,
8002
]
},
"servers": [
{
"name": "alpha",
"ip": "10.0.0.1"
}
]
}
TOML → JSON expands tables and arrays of tables into nested objects and arrays.
Common errors & troubleshooting
- The output shows "Invalid TOML" with a line and column. — Jump to that line: the most common causes are an unquoted string value, a duplicate key, or a missing closing bracket on an array or inline table.
- JSON → TOML reports that it needs an object at the top level. — TOML documents are always a table, so wrap a bare array or value in an object, e.g. { "items": [ ... ] }, before converting.
- A date or time value comes through as a plain string after a round-trip. — Use TOML's native date format (e.g. 1979-05-27T07:32:00Z); JSON has no date type, so values quoted as strings stay strings when converted back.
- Comments disappear when you format or convert TOML. — Formatting re-serializes the parsed data model, which does not retain comments; keep an original copy if you need the inline notes.
Frequently asked questions
- Can it convert TOML to JSON and back?
- Yes. Use the TOML → JSON mode to turn a TOML document into pretty JSON, and JSON → TOML to convert a JSON object into TOML. Tables, arrays of tables, and scalar types round-trip in both directions.
- Does the formatter validate my TOML?
- It does, as a side effect. Formatting parses the document with a spec-compliant parser first, so any syntax problem surfaces as an inline error with the line and column, making it a quick TOML validator.
- Which TOML version is supported?
- The parser targets TOML 1.0.0, so it understands inline tables, arrays of tables, dotted keys, multi-line strings, RFC 3339 dates and times, integers, floats, and booleans.
- Why does JSON → TOML reject an array at the top level?
- A TOML document is defined as a table (a set of key/value pairs), so the root must be a JSON object. Wrap a top-level array or primitive in an object before converting it to TOML.
- Are comments and key order preserved when I format TOML?
- No. Formatting re-serializes the parsed data, so inline comments are dropped and keys are emitted in canonical order with tables after scalars. Keep your original file if the comments matter.
- Is my TOML uploaded anywhere when I use this tool?
- No. All parsing, formatting, and conversion run entirely in your browser, so your configuration is processed locally on your device and never sent to a server.
Related tools
- YAML ↔ JSON — Convert YAML to JSON and back.
- JSON Formatter — Beautify, minify and validate JSON with error locations.
- XML Formatter — Beautify, minify and validate XML, and convert XML ↔ JSON.
- JSON to Code — Generate Go, Rust, Python, Java, Kotlin, C# and TypeScript types from JSON.
- OpenAPI / Swagger Formatter — Format and validate OpenAPI / Swagger specs (JSON or YAML) and count paths and operations.
All ArrayKit tools