TOML ↔ JSON Converter

Convert TOML config files to JSON and JSON to TOML instantly in your browser. Supports validation, pretty-printing, and copy-to-clipboard. No data sent to server.

Direction:
Indentation:

Input

Output

Output will appear here

Share this tool

Help others discover TOML ↔ JSON Converter

About TOML ↔ JSON Converter

How It Works

  • Paste TOML or JSON in the input panel
  • Select the conversion direction (TOML → JSON or JSON → TOML)
  • Output is generated automatically as you type
  • Copy the result with one click
  • All processing happens in your browser — no data is sent to a server

Common Use Cases

  • Converting pyproject.toml or Cargo.toml for tooling that needs JSON
  • Migrating configuration files between formats
  • Debugging TOML syntax with live error feedback
  • Generating JSON schemas from TOML config structures
  • Cross-checking configuration equivalence between formats

Frequently Asked Questions

What is TOML?

TOML (Tom's Obvious, Minimal Language) is a configuration file format designed to be easy to read and write. It uses a simple key-value syntax with sections and is commonly used for configuration files in projects like Rust's Cargo.toml, Python's pyproject.toml, and Hugo static sites.

What is the difference between TOML and JSON?

TOML is optimized for human-readable configuration files, supporting comments, multi-line strings, and date/time types natively. JSON is a general-purpose data interchange format without native comment support, preferred for APIs and data exchange. TOML maps cleanly to JSON for tools that require JSON input.

Is my data sent to a server?

No. All conversion happens entirely in your browser. Your TOML and JSON data are never transmitted to any server, so sensitive configuration data remains private.

Does this tool support TOML arrays and nested tables?

Yes. The converter handles all TOML data types including strings, integers, floats, booleans, datetime, arrays, inline tables, and nested tables (both [[array of tables]] and [nested.keys] syntax).

What happens to TOML comments when converting to JSON?

JSON does not support comments, so TOML comments are discarded during conversion. If you need to preserve notes, consider adding them as string values in your data structure.

Can I convert JSON back to TOML?

Yes. The tool supports bidirectional conversion. Paste any valid JSON and switch to 'JSON → TOML' mode to get the equivalent TOML representation. Note that some JSON structures (like deeply nested arrays of mixed types) may require minor adjustments to be valid TOML.

What TOML version does this tool support?

This tool uses the smol-toml library which supports TOML v1.0. This is the current stable version and is supported by most modern TOML parsers and tooling.

Does this tool validate TOML syntax?

Yes. If your TOML input contains syntax errors, the tool will display a clear error message explaining what went wrong, so you can fix it before using the output.

How are TOML dates and times handled in JSON output?

TOML supports native date and datetime types. When converting to JSON, these are serialized as ISO 8601 strings (e.g. '2024-01-15' or '2024-01-15T10:30:00Z') since JSON has no native date type.

Can I use this to convert pyproject.toml or Cargo.toml to JSON?

Yes. You can paste the contents of any TOML file — including pyproject.toml, Cargo.toml, or Hugo config.toml — and get the equivalent JSON representation. This is useful for tooling that only accepts JSON configuration.

What indentation options are available for the output?

You can choose between 2 spaces, 4 spaces, or tab indentation for the output. The default is 2 spaces, which is the most common convention for both JSON and TOML files.

What should I do if the conversion fails?

If conversion fails, check the error message shown in the output panel. Common issues include mismatched brackets, invalid escape sequences, or type mismatches. Fix the indicated line in your source and try again.

Share ToolsZone

Help others discover these free tools!

Share this page

TOML to JSON & JSON to TOML Converter — Free Online Tool