()
| 1 | use cel::{Context, Program}; |
| 2 | |
| 3 | fn main() { |
| 4 | // Create a CEL program that returns a JSON object |
| 5 | let program = Program::compile("{'foo': true}").unwrap(); |
| 6 | let value = program.execute(&Context::default()).unwrap(); |
| 7 | |
| 8 | // Convert the return type to JSON and cast to object |
| 9 | let json = value.json().unwrap(); |
| 10 | let object = json.as_object().unwrap(); |
| 11 | assert_eq!(Some(&serde_json::Value::Bool(true)), object.get("foo")); |
| 12 | } |