b2KIT

TOML Validator

Validate TOML configuration file syntax with error reporting and formatted JSON output conversion.

Tested tool guide Tested browser tools Checked August 16, 2026

What TOML Validator does, with a checked example

Paste TOML into the box and run the check: the tool returns a verdict - valid, or the first syntax error with its line and column - and for valid input it shows the document converted to formatted JSON. The check runs entirely in the page, so the text never leaves your browser. The most common surprise is JSON habits carrying over: trailing commas in arrays are an error, and a bare key with a dot such as a.b = 1 builds a nested table instead of one key.

Worked example

A concrete input and expected output from the current implementation.

Input

title = "TOML Example"

[database]
enabled = true
ports = [8000, 8001]

Expected output

{
  "title": "TOML Example",
  "database": {
    "enabled": true,
    "ports": [8000, 8001]
  }
}

Tables in TOML map to nested JSON objects, so [database] becomes the "database" object, while booleans, integers, and strings keep their types. The JSON is shown formatted for inspection.

How the result is produced

1

Parse and report

The text is checked against the TOML grammar token by token. The first invalid construct stops the run and is reported with its line and column, so a file with several errors needs repeated fixes. Duplicate keys, trailing commas, unterminated strings, malformed dates, and unknown escape sequences are all rejected.

2

TOML to JSON mapping

On a successful parse, TOML values are mapped to JSON: tables become objects, arrays of tables become arrays of objects, inline tables become objects, and strings, booleans, integers, and floats keep their kinds. Dates and times become strings, because JSON has no date type. Quoted keys - including keys that contain dots - become ordinary JSON property names.

Good uses

  • Before committing or deploying a TOML file - Cargo.toml, pyproject.toml, a service config - run it through the validator to catch syntax errors that would abort the build or fail at startup.
  • Convert a TOML configuration into JSON, for example to feed a JSON-only tool, inspect the nested structure, or compare two configurations after normalizing them to the same format.
  • When a program rejects a TOML file with a cryptic message, paste the file here to pin down the exact line and column of the syntax problem.

Limits and checks

  • Passing here means the file is syntactically valid TOML, nothing more. Keys your program requires can be missing, values can have the wrong types for your use, and tables can be named differently - semantic problems are invisible to any syntax validator.
  • The JSON conversion is not lossless. Dates and times become strings, 64-bit integers can exceed the range JavaScript-based consumers represent exactly, and inf and nan floats, which TOML allows, have no JSON representation at all.
  • One run reports one error: parsing stops at the first failure, so fix it and re-run to surface the next. And the strictness is the point - TOML rejects trailing commas in arrays and has no null, so omit an absent key rather than writing null.

Common questions

It says my file is valid, but my program refuses to load it. What is going on?

Syntax validity and what your program requires are different things. The file may lack keys or entries your program needs, a value may be a string where your program expects an integer, or your program's parser may implement a different version or dialect of TOML. Take a minimal reproduction file and compare the two parsers' complaints.

Will it catch duplicate keys?

Yes. Under the TOML rules, defining the same key twice in the same table, and redefining a table that already exists, are errors and are reported. Duplicates in different tables are fine, because each table is its own namespace, and two keys that differ only in case are two different keys.

References and verification

The example and behavioral notes were checked against the browser implementation. Standards and primary references below define the relevant format, formula, or platform behavior.

Related Tools