Skip to main content

A custom json validator

Project description

Build Status Coverage Status PyPI version

Json Validator

A json validator focused on speed.

  • Not recursion
  • Works with Python 2.7.x, 3.4.x, 3.5.x, 3.6. It may work with 3.7.X
  • Constrains based on python types.
  • Lazy Validation
  • Constrain definitions with python types
from json_validator import JsonValidator

constrain = {
      'string': {},  # str by default.
      'integer': {'type': int},
      'float': {'type': float},
      'boolean': {'type': bool},
      'json': {'type': dict },
      'list': {'type': list},
      'extra_1': {},
      'extra_2': {},
  json = {
      'string': 'foo',
      'integer': 42,
      'float': 1.10,
      'boolean': True
  # accepts json string, dict and lists.
  res, err = JsonValidator(constrain).validate(json)
  res == json  # => True
  err == {'extra_1': 'Missing field', 'extra_2': 'Missing field'}  # => True

See all rules for fields here.


pip install sonic182_json_validator


Install packages with pip-tools:

pip install pip-tools
pip-sync requirements.txt dev-requirements.txt


  • Documentation about rules.


  1. Fork
  2. create a branch feature/your_feature
  3. commit - push - pull request

Thanks :)

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for sonic182_json_validator, version 1.0.2
Filename, size File type Python version Upload date Hashes
Filename, size sonic182_json_validator-1.0.2-py2.py3-none-any.whl (6.4 kB) File type Wheel Python version 3.6 Upload date Hashes View hashes
Filename, size sonic182_json_validator-1.0.2.tar.gz (5.0 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page