jsonschema

jsonschemaJSON Schema <http://json-schema.org> のPython実装です(Python2.6以上とPython3をサポートしています)。

>>> from jsonschema import validate

>>> # A sample schema, like what we'd get from json.load()
>>> schema = {
...     "type" : "object",
...     "properties" : {
...         "price" : {"type" : "number"},
...         "name" : {"type" : "string"},
...     },
... }

>>> # If no exception is raised by validate(), the instance is valid.
>>> validate({"name" : "Eggs", "price" : 34.99}, schema)

>>> validate(
...     {"name" : "Eggs", "price" : "Invalid"}, schema
... )                                   
Traceback (most recent call last):
    ...
ValidationError: 'Invalid' is not of type 'number'

私たち ‘GitHub ページ < https://github.com/Julian/jsonschema/>’ _ ソース コードと問題追跡だけでなく、インストール手順 (メーリング リスト) より詳細な情報を検索できます。

Contents:

Indices and tables