TOML Formatter

Validate, format, and convert TOML to JSON — for pyproject.toml, Cargo.toml, and other config files.

Runs 100% client-side
Copy output
On this page4 sections
Input
Output
Output will appear here…

HOW TO USE

  1. 01Paste a TOML document — the sample is a Python project config.
  2. 02Format re-emits the document with normalized spacing. Validate checks syntax without changing the source.
  3. 03Convert to JSON round-trips through the parsed model — handy for piping config into tools that don't read TOML.

WHEN TO USE

Use this when reviewing or authoring Python project configs (pyproject.toml), Rust Cargo.toml files, test runner configs (pytest, cargo test), or any tool that uses TOML for settings. TOML's section-header and key-value syntax is human-readable but strict — Validate catches duplicate keys, invalid date literals, and malformed strings before the tool fails to start. Use Convert to JSON when a downstream script or CI step needs the config values in a format it can parse.

WHAT BUGS THIS FINDS

  • Duplicate key within a table

    TOML forbids duplicate keys in the same section — a copy-paste from a different config block silently overwrites in some parsers, while others throw; Validate catches it immediately.

  • Invalid inline table syntax

    Inline tables must fit on one line; a multi-line inline table is a syntax error that's easy to miss in a large config file — Validate flags the line.

  • Wrong date/time literal format

    TOML date literals require RFC 3339 format — an ISO 8601 date without a time offset ('2024-06-04') is valid but '04-06-2024' is not; Validate distinguishes them.

  • String type vs float ambiguity

    A version string like '1.0' is parsed as a float if unquoted — Convert to JSON shows whether the key arrived as number or string so you can add quotes before it reaches a version comparator.

QA USE CASES

01

pyproject.toml validation

Paste the project config after editing test dependencies or tool settings, validate syntax, and confirm the [tool.pytest.ini_options] section is well-formed before pushing.

02

Cargo.toml review

Format a Rust workspace Cargo.toml to verify dependency versions, feature flags, and workspace member paths are correctly structured.

03

Config-to-JSON for CI scripting

Convert a TOML config to JSON to extract values like test timeout or parallelism settings into a bash or Python CI script that doesn't have a TOML parser.