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
A map associates keys with values. Dot notation such as user.name is concise for a fixed identifier-like key. Bracket notation such as user["role"] makes the key explicit. Both forms read existing values; a missing key is not silently replaced.
Read the prepared example
The CEL + JSON rule is:
user.name + ' / ' + user['role']Its input is:
{
"user": {
"name": "Maya",
"role": "editor"
}
}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.namereads"Maya".user["role"]reads"editor".- String concatenation returns
"Maya / editor".
Your task
- Run both modes.
- Change the role value and confirm the output changes.
- Replace
rolein the expression withmissingand inspect the error.
Expected observation: Existing keys return their values; an absent key produces a member-not-available error.
Common mistake
A dot is not object-oriented method dispatch here. It is a convenient field or map-key selection.
Show the explanation
When the key is written as a string or cannot be expressed as a simple identifier.
Knowledge check
When is bracket notation especially useful?
Key takeaway
Maps are key-value collections. Choose a clear access form and do not assume missing keys have default values.
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.