TOML Validator

Validate TOML and re-emit it as clean, indented JSON

TOML Input

Output

Pretty JSON will appear here

About

Paste a TOML document to validate it against the TOML spec and pretty-print the parsed result as indented JSON. Handy for Cargo.toml, pyproject.toml, and config files. Everything runs in your browser; nothing is uploaded.

    Examples

    Validate a Cargo.toml section

    Input
    [package]
    name = "my-crate"
    version = "0.1.0"
    edition = "2021"
    
    [dependencies]
    serde = "1.0"
    Output
    {
      "package": {
        "name": "my-crate",
        "version": "0.1.0",
        "edition": "2021"
      },
      "dependencies": {
        "serde": "1.0"
      }
    }
    ✓ Valid TOML

    The parser reads the top-level [package] table and [dependencies] table, re-emitting them as nested JSON objects.

    Catch an inline table syntax error

    Input
    [server]
    host = "localhost"
    port = 8080
    users = { name = "alice", admin = true
    Output
    ✗ Invalid TOML
    Error: Unexpected end of file — expected } or , at line 5
    Inline table 'users' is missing its closing brace.

    The parser's line-aware error points to line 5 where the inline table is left unclosed.

    About this tool

    TOML (Tom's Obvious, Minimal Language) is a configuration file format designed to be human-readable and unambiguous. It is the native format for Rust's Cargo.toml, Python's pyproject.toml, and many other tools. Validating a TOML file before shipping it catches bracket mismatches, table key errors, and malformed inline tables before they surface as runtime errors.

    This validator parses TOML using the @iarna/toml library — the same library used by many Node.js tools — and reports every error with its line number. When the document is valid, it re-emits the parsed structure as pretty-printed JSON so you can inspect the exact data model and confirm the hierarchy is what you expected.

    How to use

    1. Paste your TOML

      Drop a Cargo.toml, pyproject.toml or any other TOML document into the editor, or load a sample to see a quick before/after.

    2. Review the result

      A Valid badge with the parsed JSON means the document is well-formed. An Invalid badge shows the parser's line-aware error so you can fix it directly.

    3. Copy the JSON

      Click Copy to grab the re-emitted JSON, which reflects the exact data model your tool will consume.

    Use cases

    Validating Cargo.toml before a cargo build

    Catch malformed dependency entries, bad version strings, or missing required fields before running the build.

    Checking pyproject.toml for poetry or maturin

    Confirm the [tool.poetry] or [build-system] section is valid so the package publishes cleanly.

    Inspecting a TOML file's structure as JSON

    Convert a TOML file to JSON to inspect the exact nested structure without running the tool that consumes it.

    Common mistakes

    Mistake:Using single quotes instead of double quotes for strings.

    Fix:TOML requires double quotes for strings. Single quotes define literal strings only — they do not escape backslashes.

    Mistake:Defining a table header twice.

    Fix:TOML tables ([section]) cannot be redefined. Use [section.sub] for nested tables, not a second [section].

    Mistake:Mixing dots in table headers with dotted keys.

    Fix:TOML treats [a.b.c] and a = { b = { c = ... } } as equivalent. Mixing both styles in the same document creates a conflict.

    Frequently asked questions

    References & standards