JSON Predicate
Partial implementation of Snell Json Predicate Draft 07.
Even if this Draft is Expired, it's still a pretty good draft of predicate over JSON.
Introduction
This specification defines JSON Predicates, a JSON-based RFC4627 syntax for the description and serialization of logical boolean predicate operations intended to be used in conjunction with other JSON-based mechanisms, such as JSON Patch RFC6902, as a means of incorporating conditional processing.
JSON Predicates can be used, for instance, to extend a JSON Patch RFC6902 document to provide for a broader range of conditional processing options not currently supported by JSON Patch.
Example
Given this JSON:
We could have a predicate like this:
which would evaluate as true
if evaluated against the previous JSON.
Rust Example
let predicate = deserialize?;
let evaluted_predicate: bool = predicate
.test;
JSON Patch
The JSON Patch methods described in draft-snell-json-test-07 are not implemented yet.
Features
First order predicate
- "contains"
- "contains-"
- "defined"
- "undefined"
- "starts"
- "starts-"
- "ends"
- "ends-"
- "type"
- "in"
- "in-"
- "matches"
- "matches-"
- "test"
- "test-"
- "less"
- "more"
Second order predicate
- "and"
- "not"
- "or"
References
License
Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT) at your option.