# How to access data in Feel expression with JSON key named "function"?

**URL:** <https://forum.camunda.io/t/how-to-access-data-in-feel-expression-with-json-key-named-function/64445>\
**Category:** Discussion & Questions\
**Created:** [September 2, 2025, 1:31pm UTC](https://forum.camunda.io/t/how-to-access-data-in-feel-expression-with-json-key-named-function/64445 "2025-09-02T13:31:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jon1123](https://forum.camunda.io/letter_avatar_proxy/v4/letter/j/958977/32.png) [@jon1123](https://forum.camunda.io/u/jon1123)\
**Post date:** [September 2, 2025, 1:31pm UTC](https://forum.camunda.io/t/how-to-access-data-in-feel-expression-with-json-key-named-function/64445/1 "2025-09-02T13:31:28Z")

</div>

I have a JSON object like this

```json
 {
  "body": {
    "message": {
      "role": "assistant",
      "content": "",
      "tool_calls": [
        {
          "function": {
            "name": "get_random_joke",
            "arguments": {
              "topic": "coffee"
            }
          }
        },
        {
          "function": {
            "name": "get_random_joke",
            "arguments": {
              "topic": "coffee"
            }
          }
        },
        {
          "function": {
            "name": "get_random_joke",
            "arguments": {
              "topic": "coffee"
            }
          }
        }
      ]
    }
  }
}

```

And I want to map it to a list like [“get\_random\_joke”, “get\_random\_joke”, “get\_random\_joke”].

I am unable to because the word `function` is protected?

[Playground](https://nikku.github.io/feel-playground/?e=body.message.tool_calls%5B1%5D.function.name&c=%7E3YCAkIAGgoCAgICAgICQnj3CoLz1Lnn0vdC5xfi23XUbsklKDhgXNqEYqWgPDCIMLCxJS8HMZiAIsoE1rql1Quah7xbhTwyuvN9%2FIOwvTjs0PwhhJef8UdXNP8sbkAZDdmNPm6rEq%2BF2kdepZzG5mKiqLGhSKDqso%2F9924xEMwIMwHneFOCRRakCcDbO5Sd8N7VAQ042Hk%2BzlQnI8lxZkv%2Fi5cxiX66D6Fx%2FZKLuIA%3D%3D&t=expression&st=true)

---

<div class="post-metadata">

**Author:** ![zee-bot](https://forum.camunda.io/user_avatar/forum.camunda.io/zee-bot/32/32886_2.png) [@zee-bot](https://forum.camunda.io/u/zee-bot)\
**Post date:** [September 2, 2025, 1:32pm UTC](https://forum.camunda.io/t/how-to-access-data-in-feel-expression-with-json-key-named-function/64445/2 "2025-09-02T13:32:11Z")

</div>

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:

```feel
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:

```feel
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:

```feel
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"]`

## References:

- [FEEL Variables - Escape variable names](https://docs.camunda.io/docs/components/modeler/feel/language-guide/feel-variables/#escape-variable-names)
- [Context built-ins - get value](https://docs.camunda.io/docs/components/modeler/feel/builtin-functions/feel-built-in-functions-context/#get-valuecontext-key)
- [Context expressions - Projection](https://docs.camunda.io/docs/components/modeler/feel/language-guide/feel-context-expressions/#projection)

The backtick approach is probably the most readable for your use case!

---

<div class="post-metadata">

**Author:** ![jon1123](https://forum.camunda.io/letter_avatar_proxy/v4/letter/j/958977/32.png) [@jon1123](https://forum.camunda.io/u/jon1123)\
**Post date:** [September 2, 2025, 1:35pm UTC](https://forum.camunda.io/t/how-to-access-data-in-feel-expression-with-json-key-named-function/64445/3 "2025-09-02T13:35:30Z")

</div>

> [@zee-bot](#):
>
> ```auto
> for tool in body.message.tool_calls return get value(tool, "function").name
> 
> ```

Thanks! The backticks still fail in the playground but `for tool in body.message.tool_calls return get value(tool, "function").name ` works.

Well done.

---

<div class="post-metadata">

**Author:** ![zee-bot](https://forum.camunda.io/user_avatar/forum.camunda.io/zee-bot/32/32886_2.png) [@zee-bot](https://forum.camunda.io/u/zee-bot)\
**Post date:** [September 2, 2025, 1:35pm UTC](https://forum.camunda.io/t/how-to-access-data-in-feel-expression-with-json-key-named-function/64445/4 "2025-09-02T13:35:37Z")

</div>

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:

```feel
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.

---

<div class="post-metadata">

**Author:** ![system](https://forum.camunda.io/uploads/default/original/3X/5/8/58d50142eacca605d35cb1ef9e6b86ae85f49436.png) [@system](https://forum.camunda.io/u/system)\
**Post date:** [September 9, 2025, 1:35pm UTC](https://forum.camunda.io/t/how-to-access-data-in-feel-expression-with-json-key-named-function/64445/5 "2025-09-09T13:35:56Z")

</div>

Closed on September 9, 2025, 1:35pm UTC

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
