jsonschema
A high-performance JSON Schema validator for Rust.
use json;
You also can use it from the command line via the jsonschema-cli crate.
$ jsonschema-cli schema.json -i instance.json
See more usage examples in the documentation.
⚠️ Upgrading from older versions? Check our Migration Guide for key changes.
Highlights
- 📚 Full support for popular JSON Schema drafts
- 🔧 Custom keywords and format validators
- 🌐 Blocking & non-blocking remote reference fetching (network/file)
- 🎨 Structured Output v1 reports (flag/list/hierarchical)
- ✨ Meta-schema validation for schema documents, including custom metaschemas
- 🔗 Bindings for Python and Ruby
- 🚀 WebAssembly support
- 💻 Command Line Interface
Supported drafts
The following drafts are supported:
You can check the current status on the Bowtie Report.
Notable Users
- Tauri: Config validation
- Apollo Router: Config file validation
- qsv: CSV record validation with custom keyword & format validator
Performance
jsonschema outperforms other Rust JSON Schema validators in most scenarios:
- Up to 75-645x faster than
valicoandjsonschema_validfor complex schemas - Generally 2-52x faster than
boon, and >5000x faster for recursive schemas
For detailed benchmarks, see our full performance comparison.
Minimum Supported Rust Version (MSRV)
This crate requires Rust 1.83.0 or later.
TLS Configuration
By default, jsonschema uses aws-lc-rs as the TLS cryptography provider, which is the default one in reqwest.
Using Ring Instead
You can opt into using ring as the TLS provider:
[]
= { = "0.42", = false, = ["resolve-http", "resolve-file", "tls-ring"] }
Note: To ensure aws-lc-rs is not pulled in, disable default features (which include tls-aws-lc-rs) and explicitly enable tls-ring with the features you need.
Priority behavior: If both tls-aws-lc-rs and tls-ring features are enabled (e.g., through dependency resolution or --all-features), aws-lc-rs takes precedence. To use ring, you must disable default features as shown above.
When to use tls-ring:
- You encounter errors like
undefined symbol: aws_lc_0_xx_x_EVP_PKEY_bitswhen building from source - You're on a Linux distribution where
aws-lc-rsis not available or compatible - You have specific requirements to use
ring
Warning: Using tls-ring may cause conflicts if your application also depends on other libraries that use the default aws-lc-rs provider. For most users, the default configuration is recommended.
Acknowledgements
This library draws API design inspiration from the Python jsonschema package. We're grateful to the Python jsonschema maintainers and contributors for their pioneering work in JSON Schema validation.
Support
If you have questions, need help, or want to suggest improvements, please use GitHub Discussions.
Sponsorship
If you find jsonschema useful, please consider sponsoring its development.
Contributing
We welcome contributions! Here's how you can help:
- Share your use cases
- Implement missing keywords
- Fix failing test cases from the JSON Schema test suite
See CONTRIBUTING.md for more details.
License
Licensed under MIT License.