93 releases (50 breaking)

0.53.0 Jan 19, 2026
0.52.2 Nov 24, 2025
0.51.2 Nov 21, 2025
0.49.1 Jul 4, 2025
0.8.0 Jul 28, 2023

#1052 in Text processing

Download history 573/week @ 2025-10-22 535/week @ 2025-10-29 493/week @ 2025-11-05 325/week @ 2025-11-12 438/week @ 2025-11-19 459/week @ 2025-11-26 603/week @ 2025-12-03 924/week @ 2025-12-10 574/week @ 2025-12-17 87/week @ 2025-12-24 184/week @ 2025-12-31 615/week @ 2026-01-07 970/week @ 2026-01-14 875/week @ 2026-01-21 1263/week @ 2026-01-28 1471/week @ 2026-02-04

4,819 downloads per month
Used in 2 crates

MIT license

325KB
8K SLoC

A lightweight expression language designed for the evaluation of expressions in various contexts.

Zen Expression is a versatile single-threaded expression language designed for simplicity high-performance. It's primarily used for evaluating and processing JSON data offers key components that empower developers in creating responsive and non-blocking I/O applications Out of the box, it comes with amazing benefits:

  • 🚀 Blazingly fast - Perform millions of evaluations per second
  • 🧠 Intuitive syntax - Minimalistic and expressive syntax
  • 💼 Portable - Can be compiled for all standard architectures including WASM

For a full list of language references, visit documentation.

Example

Evaluate expression using isolate:

use zen_expression::evaluate_expression;
use zen_expression::variable::Variable;
use rust_decimal_macros::dec;
use serde_json::json;

fn main() {
    let context = json!({ "tax": { "percentage": 10 } });
    let tax_amount = evaluate_expression("50 * tax.percentage / 100", context.into()).unwrap();

    assert_eq!(tax_amount, Variable::Number(dec!(5)));
}

High Performance

When evaluating a lot of expressions at once, you can use Isolate directly. Under the hood, Isolate will re-use allocated memory from previous evaluations, drastically improving performance.

use zen_expression::Isolate;
use zen_expression::variable::Variable;
use rust_decimal_macros::dec;
use serde_json::json;

fn main() {
    let context = json!({ "tax": { "percentage": 10 } });
    let mut isolate = Isolate::with_environment(context.into());

    // Fast 🚀
    for _ in 0..1_000 {
        let tax_amount = isolate.run_standard("50 * tax.percentage / 100").unwrap();
        assert_eq!(tax_amount, Variable::Number(dec!(5)));
    }
}

Feature flags

Name Description Default?
regex-deprecated Uses standard regex crate Yes
regex-lite Opts for usage of lightweight regex-lite crate. Useful for reducing build size, especially in WASM. No

Dependencies

~11–23MB
~224K SLoC