You’re correct that function is a reserved keyword in FEEL! There are two ways to access JSON keys that are reserved keywords or contain special characters:
Solution 1: Using Backticks (Camunda Extension)
You can escape the reserved keyword using backticks:
for tool in body.message.tool_calls return tool.`function`.name
Solution 2: Using the get value() Function
You can use the built-in get value() function to access keys by string:
for tool in body.message.tool_calls return get value(tool, "function").name
Alternative: Simple List Projection
If you prefer a more concise approach, you can also use FEEL’s list projection syntax combined with backticks:
body.message.tool_calls.`function`.name
All of these expressions will give you the desired result: ["get_random_joke", "get_random_joke", "get_random_joke"]
Perfect! I’m glad the get value() function approach worked for you.
You’re right that the backticks might not work in all FEEL environments - the get value(context, "key") function is the most reliable and universal way to access JSON keys that are reserved keywords or contain special characters.
Your final working solution:
for tool in body.message.tool_calls return get value(tool, "function").name
This successfully extracts the function names from your nested JSON structure and returns the list ["get_random_joke", "get_random_joke", "get_random_joke"] as desired.
Thanks for confirming the solution works! Feel free to reach out if you have any other FEEL expression questions.