A JsonLogic implementation in Rust.
To use this library, add
toml
[dependencies]
jsonlogic = "0.2"
to your Cargo.toml
.
```rust use serde_json::{json, Value};
let rule = json!({"===": [2, {"var": "foo"}]}); asserteq!(jsonlogic::apply(&rule, &json!({ "foo": 2 })), Ok(Value::Bool(true))); asserteq!(jsonlogic::apply(&rule, &json!({ "foo": 3 })), Ok(Value::Bool(false))); ```
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
❌ #8