jsonfilter/examples/filter.rs

18 lines
453 B
Rust
Raw Permalink Normal View History

2024-02-09 14:34:12 +01:00
use jsonfilter::matches;
use serde_json::json;
fn main() {
let filter = json!({"name": "John", "age": 30});
let obj = json!({"name": "John", "age": 30, "city": "New York"});
println!("Applying filter:");
println!("{}", filter);
println!("To object:");
println!("{}", obj);
if matches(&filter, &obj) {
println!("Filter matches the object");
} else {
println!("Filter does not match the object");
}
}