A JsonLogic implementation in Rust.
To use this library, add
toml
[dependencies]
jsonlogic = "0.5"
to your Cargo.toml
.
```rust use serde_json::{json, Value};
let rule = json!({ "===": [ 2, { "var": "foo" } ] });
let data = json!({ "foo": 2 }); assert_eq!(jsonlogic::apply(&rule, &data), Ok(Value::Bool(true)));
let data = json!({ "foo": 3 }); assert_eq!(jsonlogic::apply(&rule, &data), Ok(Value::Bool(false))); ```
For detailed informations about all supported operations and their arguments, head over to Supported Operations on jsonlogic.com.
var
✅missing
✅missing_some
✅if
✅==
✅===
✅!=
✅!==
✅!
✅!!
✅or
✅and
✅>
, >=
, <
, and <=
✅max
and min
✅+
-
*
/
✅%
✅map
, reduce
and filter
✅all
, none
and some
✅merge
✅in
✅in
✅cat
✅substr
✅log
✅