JSON file format validation.

This folder contains JSON-Schema files for validating files in JSON format that are used or created by LAMMPS.

JSON-Schema files

We provide schema files for the file formats that LAMMPS supports following the specifications available on JSON-Schema webpage. The following files are currently available.

These files provide a concise description of the hierarchy and supported fields in JSON file formats. Thus they provide a detailed documentation and can also be used for validating JSON files.

Validation of JSON files

There are multiple tools for JSON file validation available. Here are instructions for how to use a tool called check-jsonschema which is available via PyPi.

# Installation into a virtual environment.
# Once installed only the activation should be needed
python3 -m venv validate-json
source validate-json/bin/activate
pip install --upgrade pip
pip install check-jsonschema

# Validation of two molecule files "rxn1.json" and "twomols.json" with "molecule-schema.json"
check-jsonschema --schemafile molecule-schema.json rxn1.json twomols.json

If the files are conforming there should be the output:

ok -- validation done

Otherwise details about the non-conforming fields are given.