JSON Schema can be used to validate TOML documents. Tom's Obvious, Minimal Language (TOML) is a minimal language with growing popularity that is largely compatible with JSON, though more restrictive. There is a proposal for a TOML-specific schema language, which may be a viable option in the future. However, until such a proposal gains traction and is implemented, JSON Schema remains the most available option for validating TOML files.

JSON

{
    "id": 2,
    "name": "An ice sculpture",
    "price": 12.5,
    "tags": [
        "cold",
        "ice"
    ],
    "dimensions": {
        "length": 7,
        "width": 12,
        "height": 9.5
    },
    "warehouseLocation": {
        "latitude": -78.75,
        "longitude": 20.4
    }
}

TOML

id = 2.0
name = "An ice sculpture"
price = 12.5
tags = ["cold", "ice"]

[dimensions]
length = 7.0
width = 12.0
height = 9.5

[warehouseLocation]
latitude = -78.75
longitude = 20.4
Example JSON from the JSON Schema website.

Editor Support

No editors supporting JSON Schema validation of TOML documents are known.

Tools and Libraries

  • Polyglottal JSON Schema Validator - Written in JavaScript. Released under the MIT license.
    • Polyglottal JSON Schema Validator (pajv) is a command line utility that can be used to validate data in numerous formats against a JSON Schema.

Alternatives