| Crates.io | datalogic-rs |
| lib.rs | datalogic-rs |
| version | 4.0.9 |
| created_at | 2024-11-19 02:20:35.614503+00 |
| updated_at | 2026-01-24 05:44:00.272908+00 |
| description | A fast, type-safe Rust implementation of JSONLogic for evaluating logical rules as JSON. Perfect for business rules engines and dynamic filtering in Rust applications. |
| homepage | https://github.com/GoPlasmatic/datalogic-rs |
| repository | https://github.com/GoPlasmatic/datalogic-rs |
| max_upload_size | |
| id | 1452835 |
| size | 699,079 |
use datalogic_rs::DataLogic;
use serde_json::json;
let engine = DataLogic::new();
let logic = json!({ ">": [{ "var": "age" }, 18] });
let compiled = engine.compile(&logic).unwrap();
let result = engine.evaluate_owned(&compiled, json!({ "age": 21 })).unwrap();
assert_eq!(result, json!(true));
| Package | Description | Install |
|---|---|---|
| datalogic-rs | Rust library | cargo add datalogic-rs |
| @goplasmatic/datalogic | WASM/JavaScript | npm i @goplasmatic/datalogic |
| @goplasmatic/datalogic-ui | React visual debugger | npm i @goplasmatic/datalogic-ui |
Try the JSONLogic Online Debugger to interactively test your rules
Arc sharingimport init, { evaluate } from '@goplasmatic/datalogic';
await init();
const result = evaluate(
'{">=": [{"var": "age"}, 18]}',
'{"age": 21}',
false
);
console.log(JSON.parse(result)); // true
import { DataLogicEditor } from '@goplasmatic/datalogic-ui';
<DataLogicEditor
value={{ "and": [{ ">": [{ "var": "age" }, 18] }, { "var": "active" }] }}
data={{ age: 25, active: true }}
mode="debug"
/>
Created by Plasmatic, building open-source tools for financial infrastructure and data processing.
Licensed under Apache 2.0. See LICENSE for details.