JSONGuard
Fast, pythonic JSON schema validation, published on PyPI
- Faster than fastjsonschema
- 116×
- Faster than jsonschema
- 298×
- Lines of core code
- ~250
JSONGuard is a fast, pythonic JSON Schema validator distributed on PyPI. Schemas are defined directly with Python's built-in types and type hints (inspired by sqlmodel), so you skip the boilerplate of formal JSON Schema documents while still getting strict type enforcement, optional fields, and custom validator functions.
The library is roughly 250 lines of optimised code and uses orjson under the hood. Benchmarks place it at ~116× faster than fastjsonschema on basic validation, with depth protection, payload size limits, and either fail-fast or collect-all-errors modes for diagnostics.
What I built
- Pythonic schema definitions
- Schemas are plain Python dicts using built-in types, Union, and Optional. No separate JSON Schema document or DSL to learn.
- Composable custom validators
- Any callable that returns True on valid input works as a validator, enabling regex, range, and domain-specific checks directly inside the schema.
- Performance-first implementation
- Backed by orjson with a tight ~250-line core; benchmarks show ~116× faster basic validation than fastjsonschema and ~298× faster than jsonschema.
- Hardening options
- Configurable max_size_in_bytes, max_depth, and loosely_typed flags protect against oversized payloads and deeply nested DoS attempts.
- Library Author
- April 2026
- Python, orjson, Type Hints, Pytest, Benchmark tooling
Sundial Lands
Land-buying and cash-offer platform, built solo end to end
Got something to build? Let's talk.
A full build, an AI integration, or a second opinion on architecture. Most projects start with a thirty-minute call, and I reply to every serious enquiry within a day.
- Status