Pulsars

TOML to JSON Converter — Parse TOML Configuration to JSON

TOML3 lines
JSON5 lines

TOML (Tom's Obvious, Minimal Language) is a configuration file format designed to be easy to read and write. It's the native config format for Rust's Cargo (Cargo.toml), Python's pyproject.toml, Hugo static sites, and Deno. TOML supports typed values (strings, integers, floats, booleans, dates), nested tables, and inline tables — making it more expressive than INI files while remaining simpler than YAML.

When should you convert TOML to JSON?

TOML-to-JSON conversion is useful when processing configuration files programmatically in JavaScript or Python, when migrating project configs between ecosystems, or when you need to validate TOML structure against a JSON schema. Unlike YAML, TOML has no ambiguity in parsing — the same TOML always produces the same data structure.

Frequently Asked Questions

What is TOML and when is it used?

+

TOML (Tom's Obvious Minimal Language) is a configuration file format designed to be easy to read and write. It's used by Rust's Cargo.toml, Python's pyproject.toml, Hugo static site configs, and many other tools. TOML supports typed values (strings, integers, floats, booleans, dates), tables (sections), and arrays.

How are TOML tables converted to JSON?

+

TOML tables ([section]) become nested JSON objects. For example, [database] followed by host = "localhost" becomes {"database": {"host": "localhost"}}. Array of tables ([[items]]) become JSON arrays of objects.

Does it support TOML dates and times?

+

Yes. TOML native date/datetime types (like 2024-01-15 or 2024-01-15T10:30:00Z) are converted to their ISO string representation in JSON, since JSON has no native date type.

Can I convert JSON back to TOML?

+

Yes! Use the format selectors to swap the direction. Note that TOML has some constraints: it requires a top-level table (object), doesn't support null values, and top-level arrays must be wrapped. The converter handles these edge cases automatically.

Is this safe for Cargo.toml and pyproject.toml?

+

Absolutely. All parsing happens in your browser using the smol-toml library (TOML v1.0 compliant). No data is sent to any server. Your configuration files stay entirely on your device.