jsonlogic 0.3.0

A JsonLogic implementation in Rust
Documentation

jsonlogic_rs   Build Status Latest Version

A JsonLogic implementation in Rust.

To use this library, add

[dependencies]
jsonlogic = "0.3"

to your Cargo.toml.

Usage

use serde_json::{json, Value};

let rule = json!({"===": [2, {"var": "foo"}]});
assert_eq!(jsonlogic::apply(&rule, &json!({ "foo": 2 })), Ok(Value::Bool(true)));
assert_eq!(jsonlogic::apply(&rule, &json!({ "foo": 3 })), Ok(Value::Bool(false)));

Operator Support

  • Accessing Data
    • var
    • missing
    • missing_some
  • Logic and Boolean Operations ✅
    • if
    • ==
    • ===
    • !=
    • !==
    • !
    • !!
    • or
    • and
  • Numeric Operations
    • >, >=, <, and <=
    • Between ✅
    • max and min
    • Arithmetic, + - * /
    • %
  • Array Operations #6
    • map, reduce and filter
    • all, none and some
    • merge
    • in
  • String Operations #7
    • in
    • cat
    • substr
  • Miscellaneous
    • log#8