https://github.com/sourcemeta/blaze
The ultra high-performance C++ JSON Schema validator, providing validation in the nano-second range along with perfect compliance scores. Supports Draft 4, Draft 6, Draft 7, 2019-09 and 2020-12. For both servers and embedded devices
https://github.com/sourcemeta/blaze
c-plus-plus cpp high-performance json json-parser json-schema json-schema-validation json-schema-validator jsonschema jsonschema-validator modern-cpp performance
Last synced: 6 days ago
JSON representation
The ultra high-performance C++ JSON Schema validator, providing validation in the nano-second range along with perfect compliance scores. Supports Draft 4, Draft 6, Draft 7, 2019-09 and 2020-12. For both servers and embedded devices
- Host: GitHub
- URL: https://github.com/sourcemeta/blaze
- Owner: sourcemeta
- License: other
- Created: 2024-10-15T18:24:50.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2025-04-16T19:50:35.000Z (9 days ago)
- Last Synced: 2025-04-17T04:17:06.118Z (8 days ago)
- Topics: c-plus-plus, cpp, high-performance, json, json-parser, json-schema, json-schema-validation, json-schema-validator, jsonschema, jsonschema-validator, modern-cpp, performance
- Language: C++
- Homepage: http://blaze.sourcemeta.com/
- Size: 214 MB
- Stars: 67
- Watchers: 2
- Forks: 6
- Open Issues: 12
-
Metadata Files:
- Readme: README.markdown
- License: LICENSE
Awesome Lists containing this project
README
Blaze
=====The ultra high-performance JSON Schema validator for C++ with support for JSON
Schema Draft 4, Draft 6, Draft 7, 2019-09, and 2020-12.[](https://doi.org/10.5281/zenodo.14867298)




Benchmark
---------The 2025 paper [Blaze: Compiling JSON Schema for 10x Faster
Validation](https://arxiv.org/abs/2503.02770) presents a reproducible benchmark
comparing Blaze against a number of popular JSON Schema validators, concluding
that Blaze is on average _at least_ 10x faster than competitors given a large
set of representative schemas and instances.[](https://arxiv.org/abs/2503.02770)
Features
--------- **Performance:** Blaze compiles JSON Schema into a lower-level intermediate
language for ultra fast evaluation. It can achieve schema validation in the
nano-second range, making it a perfect fit for low-latency gateways and
validation of large datasets- **Compliance:** Blaze achieves a 100% compliance score in the official
[Bowtie](https://bowtie.report/#/implementations/cpp-blaze) benchmark, while
popular validators like [AJV](https://bowtie.report/#/implementations/js-ajv)
only achieve an average 85% compliance. Furthermore, Blaze is built and
maintained by a [JSON Schema TSC member](https://www.jviotti.com)- **Extensibility:** Blaze supports the implementation of custom vocabularies
of arbitrary complexity, and the ability to setup custom resolution of
external schemas from arbitrary sources, like from HTTP, filesystem,
databases, etc- **Annotations:** Blaze is one of the few implementations that fully supports
annotation extraction during evaluation to augment instances with semantic
information, making it a great fit for data science scenariosExample
-------Blaze is designed to be easy to use, while at the same time providing extensive
hooks for supporting custom vocabularies, resolving external schemas, and more.```cpp
// (1) Get a JSON Schema
const auto schema{sourcemeta::core::parse(R"JSON({
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "string"
})JSON")};// (2) Compile the JSON Schema into an optimised representation
const auto compiled_schema{sourcemeta::blaze::compile(
schema,// These options allow you tweak how Blaze works,
// the JSON Schema vocabularies it understands,
// and how to resolve references to external schemas
sourcemeta::core::schema_official_walker,
sourcemeta::core::schema_official_resolver,
sourcemeta::blaze::default_schema_compiler,// Fast validation means getting to a boolean result
// as fast as possible. Check out the documentation
// for how to get detailed error information and/or
// collect JSON Schema annotations
sourcemeta::blaze::Mode::FastValidation)};// (3) Get a JSON instance
const sourcemeta::core::JSON instance{"Hello Blaze!"};// (4) Validate the instance against the schema
sourcemeta::blaze::Evaluator evaluator;
const auto result{evaluator.validate(compiled_schema, instance)};
if (result) {
std::cout << "Success!\n";
}
```Documentation
-------------Refer to the project website for documentation:
[https://blaze.sourcemeta.com](https://blaze.sourcemeta.com).Roadmap
-------- Support running the validator on [simdjson](https://github.com/simdjson/simdjson)
- Provide bindings to higher-level programming languages (Node.js, Go, etc)Contributors
------------Blaze was designed and developed by a team of passionate JSON Schema developers
and researchers.