A utility library for working with JSON Table Schema in Python.
pip install jsontableschema
A utility library for working with JSON Table Schema in Python.
- A core set of utilities for working with JSON Table Schema
- Use in other packages that deal with actual validation of data, or other 'higher level' use cases around JSON Table Schema (e.g.: Tabular Validator)
- Be 100% compliant with the the JSON Table Schema specification (we are not there yet)
types
: a collection of classes to validate type/format of data described by a JSON Table Schemamodels.JSONTableSchema
: A model around a schema with useful methods for interactioninfer
: a utility that creates a JSON Table Schema based on a data samplevalidate
: a utility to validate a schema as valid according to the current spec
Let's look at each of these in more detail.
from jsontableschema import types
Type and format checking for data values.
from jsontableschema.models import JSONTableSchema
A model of a schema with helpful methods for working with the data a schema represents.
from jsontableschema import infer
Give a sample of data, get back a schema for the data.
from jsontableschema import validate
Give a schema as any of JSON file, url to JSON file, or a Python dict, and get back a response as to whether it is valid.
JSON Table Schema features a CLI called jsontableschema
. This CLI exposes the infer
and validate
functions for command line use.
> jsontableschema infer path/to/data.csv
The response is a schema as JSON.
> jsontableschema validate path/to-schema.json
The response is...