What you will do
You will run the prepared expression in the playground above, change one input at a time, and explain the result. Start in CEL only, then repeat the same rule in CEL + JSON.
How it works
Every CEL value has a type. Here user.name is a string, user.score is a double in the JSON mode, and the comparison produces a bool. This playground maps JSON numbers to double; therefore the threshold is written as 80.0. CEL does not silently convert the string "86" into a number.
Read the prepared example
The CEL + JSON rule is:
user.name == 'Maya' && user.score >= 80.0Its input is:
{
"user": {
"name": "Maya",
"score": 86,
"active": true
}
}The CEL only tab contains the values and the rule in one expression. The enabled cel.bind() extension keeps each name local to its final argument.
Evaluation step by step
user.name == 'Maya'evaluates totrue.user.score >= 80.0evaluates totrue.true && truereturnstrue.
Your task
- Run both modes and inspect the result type.
- Change the JSON score to
79and run again. - Put
"86"in quotes, observe the type error, then remove the quotes.
Expected observation: A score of 79 returns false; a quoted score produces an incompatible-type error.
Common mistake
A JSON number and a number inside a self-contained CEL expression can enter the playground with different numeric types. Match the operands or convert explicitly.
Show the explanation
"86" is a string. CEL does not perform an implicit string-to-number conversion.
Knowledge check
Why does "86" >= 80.0 fail instead of returning true?
Key takeaway
Types are part of the rule. Use compatible operands and make conversions visible.
Sources
CEL-DEV— official CEL overview.CEL-LANG— official CEL language definition.CEL-GO-BIND— official documentation for the optionalcel.bind()extension used by the self-contained tab.