Guide
Input7 lines · 85 B
Output

Root JSON arrays map to a TOML items table. TOML → JSON uses a standard parser; all processing runs in your browser.

Guide: JSON ↔ TOML Converter

↑ Back to tool

What is this tool?

Convert JSON to TOML and TOML to JSON in your browser. Paste either format—the tool detects JSON (objects/arrays) or valid TOML and shows the opposite on the other side. Debounced conversion, Monaco editors, copy and swap. No upload—processing is client-side.

For TOML-only pretty-printing or validation without converting, use the TOML Formatter.

💡 Quick tip

A root JSON array becomes a TOML structure with an items array—common for converters. If you need a different shape, edit the TOML after conversion.

Why convert between JSON and TOML?

JSON is everywhere in APIs and browser tooling. TOML is a popular choice for config files (Cargo.toml, pyproject.toml, static site generators). Moving between them helps you paste API responses into config templates, compare structures, or migrate snippets without installing CLI tools.

How conversion works

  • JSON → TOML — The root value must be an object or array. Root arrays map to an items array in TOML (same convention as many online converters).
  • TOML → JSON — Parsed TOML is serialized as indented JSON. TOML datetimes become JSON strings (typically ISO-style).
  • Swap — Move output into the input to round-trip or iterate quickly.
  • Auto-detect — You can often paste blindly; if detection is ambiguous, pick JSON or TOML mode in the tool.

How to use

  1. Paste — JSON or TOML in the input panel (or load samples).
  2. Check detection — Confirm the badge shows JSON or TOML; switch mode if needed.
  3. Read the output — The opposite format updates as you type (debounced).
  4. Swap or copy — Use Swap to edit the result as new input, or copy from the output panel.

Use cases

ScenarioHow this tool helps
Config migrationTurn a JSON sample into a TOML starter for Rust/Python projects.
DebuggingCompare the same data as JSON vs TOML to spot nesting or key issues.
Docs & snippetsGenerate either syntax for README examples or tickets.
Round-trip checksSwap output back to input to verify lossy steps (types, datetimes).

Best practices

  • Validate after conversion — Especially for dates and nested tables; TOML and JSON types differ slightly at the edges.
  • Large payloads — Very big documents can feel slow in the browser; split or use local tools for huge files.
  • Comments — TOML comments are lost when converting to JSON; keep a copy if you need them.

Limitations

TOML comments are not preserved in JSON output. Root JSON arrays use the items convention in TOML—adjust if your project expects a different layout. Very large documents may feel slow. All processing is client-side.

FAQ

Is JSON ↔ TOML conversion free?

Yes. It runs in your browser with no sign-up.

Does it preserve TOML comments in JSON?

No. Comments are discarded when serializing to JSON.

Why does my root JSON array become items in TOML?

TOML requires a table structure; mapping a root array to an items key is a common convention so the file stays valid.

Can I force JSON vs TOML if auto-detect is wrong?

Use the tool’s input mode controls when auto-detect isn’t sure.

This tool is often searched as json to toml, toml to json, json toml converter online, convert json to toml, toml json converter, cargo toml to json, and pyproject toml to json. Spoold handles bidirectional conversion with detection and editors in one page.

Similar tools

Other Spoold utilities that pair well with JSON ↔ TOML:

Conclusion

Use this JSON ↔ TOML converter for quick two-way conversion, detection, and round-trips. For YAML, try JSON ↔ YAML; for TOML-only formatting, use TOML Formatter; for raw JSON editing, use the JSON Formatter.