17 lines
453 B
Rust
17 lines
453 B
Rust
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");
|
|
}
|
|
}
|