If you haven't check jsonschema library, it can be useful to validate data. JSON Schema is a way to describe the content of JSON. The library just uses the format to make validations based on the given schema.

I made a simple example from basic usage.

import json
from jsonschema import validate

# Describe what kind of json you expect.
schema = {
    "type" : "object",
    "properties" : {
        "description" : {"type" : "string"},
        "status" : {"type" : "boolean"},
        "value_a" : {"type" : "number"},
        "value_b" : {"type" : "number"},
    },
}

# Convert json to python object.
my_json = json.loads('{"description": "Hello world!", "status": true, "value_a": 1, "value_b": 3.14}')

# Validate will raise exception if given json is not
# what is described in schema.
validate(instance=my_json, schema=schema)

# print for debug
print(my_json)
Answer from T.Nylund on Stack Overflow
🌐
jsonschema
python-jsonschema.readthedocs.io › en › stable › validate
Schema Validation - jsonschema 4.26.0 documentation
Validating a format failed. The JSON Schema specification recommends (but does not require) that implementations use ECMA 262 regular expressions. Given that there is no current library in Python capable of supporting the ECMA 262 dialect, the regex format will instead validate Python regular ...
Discussions

I wrote okjson - A fast, simple, and pythonic JSON Schema Validator
https://github.com/mufeedvh/okjson/blob/main/okjson/validator.py It's useful to use a formatter/linter and configure your text editor to be aligned with the linter. $> pylint okjson | grep 'Bad indentation' | wc -l 100 black is a popular formatter used by the community. https://github.com/psf/black pylint is a useful listing tool. https://pylint.pycqa.org/en/latest/ Best of luck to you on your project. More on reddit.com
🌐 r/Python
4
14
March 31, 2022
JSON deserializer and validator
You might like to be aware of "jsonpickle". I imagine you might want a more "language agnostic" json schema or one that is more reliable (though in practice I think the serialization will change any time soon. You should also be aware of json schemas in general https://json-schema.org/ and the similarity of this to some of WSDL/soap standards (though these use xml rather than json). I'm really not a fan of these and when I've been forced to play with them before they did not work that well. Things like this: https://github.com/Julian/jsonschema might be interesting It doesn't look like json schemata are designed for deserialization. More on reddit.com
🌐 r/Python
7
4
September 7, 2018
Big Query JSON Validation
heres a bq schema validator in node https://github.com/holidayextras/jsonschema-bigquery More on reddit.com
🌐 r/bigquery
1
2
November 26, 2019
What problems does pydantic solves? and How should it be used
pydantic protects data that's coming into your fully-typed Python application. It ensures everything is accurate and valid, and it's very good at what it does. It makes it super easy to use your type annotations because you know the data is going to "look" correct to the function/class it goes into. Once the data is inside, you can keep using pydantic models or dataclasses -- or switch to dataclasses.dataclass / typing.NamedTuple. More on reddit.com
🌐 r/Python
38
59
October 1, 2023
🌐
jsonschema
python-jsonschema.readthedocs.io › en › latest › validate
Schema Validation - jsonschema 4.26.1.dev25+gad0a1b301 documentation
Validating a format failed. The JSON Schema specification recommends (but does not require) that implementations use ECMA 262 regular expressions. Given that there is no current library in Python capable of supporting the ECMA 262 dialect, the regex format will instead validate Python regular ...
🌐
Reddit
reddit.com › r/python › i wrote okjson - a fast, simple, and pythonic json schema validator
r/Python on Reddit: I wrote okjson - A fast, simple, and pythonic JSON Schema Validator
March 31, 2022 -

I had a requirement to process and validate large payloads of JSON concurrently for a web service, initially I implemented it using jsonschema and fastjsonschema but I found the whole JSON Schema Specification to be confusing at times and on top of that wanted better performance. Albeit there are ways to compile/cache the schema, I wanted to move away from the schema specification so I wrote a validation library inspired by the design of tiangolo/sqlmodel (type hints) to solve this problem easier.

Here is a simple example:

from okjson import JSONValidator

schema = { 'name': str, 'age': int }

json_string = '{ "name": "Charly Gordon", "age": 32 }'

assert JSONValidator().is_valid(instance=json_string, schema=schema)

There is an example covering all the features in the README.

It also has well defined exceptions for each error case when you want to get the reason for the validation failure. (Helpful when you want to show user facing error messages)

GitHub: https://github.com/mufeedvh/okjson

This is my first time publishing a Python library, please share your feedback/suggestions. :)

🌐
Flexiple
flexiple.com › python › python-json-validator
Python JSON Validator - Flexiple
March 28, 2024 - JSON (JavaScript Object Notation) is a widely-used data interchange format, making it essential to have a reliable method for validating JSON data. Python, being a versatile and powerful programming language, offers a built-in JSON Validator module that simplifies this process.
🌐
JSONLint
jsonlint.com
JSONLint - The JSON Validator
The best way to find and correct errors while simultaneously saving time is to use an online tool such as JSONLint. JSONLint will check the validity of your JSON code, detect and point out line numbers of the code containing errors.
Find elsewhere
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-check-whether-a-string-is-valid-json-or-not
Python | Check whether a string is valid json or not - GeeksforGeeks
July 11, 2025 - In the below example, the string is an invalid JSON because, the string characters are enclosed in single quotes ('), but as per valid JSON schema, strings must be enclosed in double quotes ("). ... # Python code to demonstrate # checking whether string # is valid json or not import json ini_string = "{'akshat' : 1, 'nikhil' : 2}" # printing initial ini_string print ("initial string", ini_string) # checking for string try: json_object = json.loads(ini_string) print ("Is valid json?
🌐
GitHub
github.com › python-jsonschema › jsonschema
GitHub - python-jsonschema/jsonschema: An implementation of the JSON Schema specification for Python · GitHub
jsonschema is an implementation of the JSON Schema specification for Python. >>> from jsonschema import validate >>> # A sample schema, like what we'd get from json.load() >>> schema = { ... "type" : "object", ... "properties" : { ... "price" : {"type" : "number"}, ...
Starred by 4.9K users
Forked by 609 users
Languages   Python 99.8% | TypeScript 0.2%
🌐
Pydantic
docs.pydantic.dev › latest › concepts › json
JSON - Pydantic Validation
""" try: return handler(v) except ValidationError as exc: # there might be other types of errors resulting from partial JSON parsing # that you allow here, feel free to customize as needed if all(e['type'] == 'missing' for e in exc.errors()): raise pydantic_core.PydanticUseDefault() else: raise class NestedModel(BaseModel): x: int y: str class MyModel(BaseModel): foo: Optional[str] = None bar: Annotated[ Optional[tuple[str, int]], WrapValidator(default_on_error) ] = None nested: Annotated[ Optional[NestedModel], WrapValidator(default_on_error) ] = None m = MyModel.model_validate( pydantic_core
🌐
PYnative
pynative.com › home › python › json › validate json data using python
Validate JSON data using Python
May 14, 2021 - Check if a string is valid JSON in Python. Validate JSON Schema using Python. Validates incoming JSON data by checking if there all necessary fields present in JSON and also verify data types of those fields
🌐
Built In
builtin.com › software-engineering-perspectives › python-json-schema
How to Use JSON Schema to Validate JSON Documents in Python | Built In
In Python, we can use the jsonschema library to validate a JSON instance (also referred to as a JSON document as long as it’s unambiguous) against a schema.
🌐
JSON Formatter
jsonformatter.curiousconcept.com
JSON Formatter & Validator
Although originally derived from the JavaScript scripting language, JSON data can be generated and parsed with a wide variety of programming languages including JavaScript, PHP, Python, Ruby, and Java. To learn more about JSON check out some of the following links. ... Install the JSON Formatter & Validator Bookmarklet to quickly and easily format and validate any public JSON URL with a single click.
🌐
Testcookbook
testcookbook.com › book › python › json-schema-validation.html
Validating JSON with Python - Test Cookbook
import json from jsonschema import validate def validate_json_syntax(d): try: return json.loads(d) except ValueError: print('DEBUG: JSON data contains an error') return False data = '{"firstName": "John", "lastName": "Doe"}' jsd = validate_json_syntax(data) schema = { "type": "object", "properties": { "firstName": { "type": "string"}, "lastName": { "type": "string"} } } #output will be None print(validate(jsd, schema))
🌐
PyPI
pypi.org › project › jsonschema
jsonschema · PyPI
An implementation of JSON Schema validation for Python
      » pip install jsonschema
    
Published   Jan 07, 2026
Version   4.26.0
🌐
W3Schools
w3schools.com › python › python_json.asp
Python JSON
JSON is text, written with JavaScript object notation. Python has a built-in package called json, which can be used to work with JSON data.
🌐
Pydantic
docs.pydantic.dev › latest › concepts › json_schema
JSON Schema - Pydantic Validation
Calling json.dumps on the schema dict produces a JSON string. The TypeAdapter class lets you create an object with methods for validating, serializing, and producing JSON schemas for arbitrary types.
🌐
JSON Schema Validator
jsonschemavalidator.net
JSON Schema Validator - Newtonsoft
An online, interactive JSON Schema validator. Supports JSON Schema Draft 3, Draft 4, Draft 6, Draft 7, Draft 2019-09 and Draft 2020-12.
🌐
PyPI
pypi.org › project › json-checker
json-checker · PyPI
json_checker is a library for validating Python data structures, such as those obtained from JSON (or something else) to Python data-types.
      » pip install json-checker
    
Published   Aug 31, 2019
Version   2.0.0
🌐
PyPI
pypi.org › project › python-jsonvalidator
python-jsonvalidator
JavaScript is disabled in your browser · Please enable JavaScript to proceed · A required part of this site couldn’t load. This may be due to a browser extension, network issues, or browser settings. Please check your connection, disable any ad blockers, or try using a different browser