# Feel expression

**URL:** <https://forum.camunda.io/t/feel-expression/47520>\
**Category:** Camunda 8 Topics\
**Tags:** dmn-engine-feel\
**Created:** [September 13, 2023, 12:45pm UTC](https://forum.camunda.io/t/feel-expression/47520 "2023-09-13T12:45:48Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![yadav1990](https://forum.camunda.io/user_avatar/forum.camunda.io/yadav1990/32/25432_2.png) [@yadav1990](https://forum.camunda.io/u/yadav1990)\
**Post date:** [September 13, 2023, 12:45pm UTC](https://forum.camunda.io/t/feel-expression/47520/1 "2023-09-13T12:45:48Z")

</div>

Hi,

I am getting the connector response in string format of third party API so, how can I convert that string response to json object in feel expression?

I can’t force the client to change the requirement/ update the API based on our need right?

TIA

---

<div class="post-metadata">

**Author:** ![nathan.loding](https://forum.camunda.io/user_avatar/forum.camunda.io/nathan.loding/32/24171_2.png) [@nathan.loding](https://forum.camunda.io/u/nathan.loding)\
**Post date:** [September 13, 2023, 2:55pm UTC](https://forum.camunda.io/t/feel-expression/47520/2 "2023-09-13T14:55:58Z")

</div>

Hi @yadav1990 - I don’t think there’s a direct way to convert a string to a context (which is what JSON-like objects are called in FEEL). You might be able to use the [substring function](https://docs.camunda.io/docs/components/modeler/feel/builtin-functions/feel-built-in-functions-string/#substringstring-start-position) to build a context, but that feels fragile to me.

I’m not sure the answer to your second question. If the API is programmed to respond with a string value rather than JSON, then the API itself needs to be changed in order to change the response. Another option would be to create your own Connector that converts the API response to an object before sending the response to the process engine. Java (and Node and Python) have much more powerful methods for converting data than FEEL!

---

<div class="post-metadata">

**Author:** ![Ingo\_Richtsmeier](https://forum.camunda.io/user_avatar/forum.camunda.io/ingo_richtsmeier/32/25968_2.png) [@Ingo\_Richtsmeier](https://forum.camunda.io/u/Ingo_Richtsmeier)\
**Post date:** [September 13, 2023, 7:36pm UTC](https://forum.camunda.io/t/feel-expression/47520/3 "2023-09-13T19:36:33Z")

</div>

Hi @yadav1990,

I’ve created a JSON value for a local variable from other existing variables with an input mapping like this:

![grafik](https://forum.camunda.io/uploads/default/original/3X/9/8/983f819d125b831258a8e2297a2a1b4838764ea9.png)

Hope this helps, Ingo

---

<div class="post-metadata">

**Author:** ![yadav1990](https://forum.camunda.io/user_avatar/forum.camunda.io/yadav1990/32/25432_2.png) [@yadav1990](https://forum.camunda.io/u/yadav1990)\
**Post date:** [September 14, 2023, 7:57am UTC](https://forum.camunda.io/t/feel-expression/47520/4 "2023-09-14T07:57:54Z")

</div>

thanks for trying but it’s what I am looking.

---

<div class="post-metadata">

**Author:** ![yadav1990](https://forum.camunda.io/user_avatar/forum.camunda.io/yadav1990/32/25432_2.png) [@yadav1990](https://forum.camunda.io/u/yadav1990)\
**Post date:** [September 14, 2023, 8:01am UTC](https://forum.camunda.io/t/feel-expression/47520/5 "2023-09-14T08:01:15Z")

</div>

exactly to the second point @nathan.loding the API itself returning in string with escape character and getting consumed by 100’s of customer so I can’t force them to change for me.

Also, I don’t want to write the code and introduce multiple connector just for parsing the different responses.

---

<div class="post-metadata">

**Author:** ![nathan.loding](https://forum.camunda.io/user_avatar/forum.camunda.io/nathan.loding/32/24171_2.png) [@nathan.loding](https://forum.camunda.io/u/nathan.loding)\
**Post date:** [September 14, 2023, 2:58pm UTC](https://forum.camunda.io/t/feel-expression/47520/6 "2023-09-14T14:58:02Z")

</div>

Are you able to share the string and an example of the object shape you’d like to see it in?

---

<div class="post-metadata">

**Author:** ![JoeWarner](https://forum.camunda.io/user_avatar/forum.camunda.io/joewarner/32/16243_2.png) [@JoeWarner](https://forum.camunda.io/u/JoeWarner)\
**Post date:** [January 28, 2025, 12:18pm UTC](https://forum.camunda.io/t/feel-expression/47520/7 "2025-01-28T12:18:26Z")

</div>

I just wanted to share my experience. I’m using the SQL Connector (with MySQL) to retrieve a JSON column. (The Connector encodes the contents of the column as base64 - which is a separate problem). If I cast the column as CHAR then I get back the JSON as a string but then there seems to be no way to parse that string back into JSON!

I strongly agree with @yadav1990 that I don’t really want to add a worker/connector to parse this data.

---

<div class="post-metadata">

**Author:** ![igormsk](https://forum.camunda.io/letter_avatar_proxy/v4/letter/i/0ea827/32.png) [@igormsk](https://forum.camunda.io/u/igormsk)\
**Post date:** [July 23, 2025, 3:00pm UTC](https://forum.camunda.io/t/feel-expression/47520/8 "2025-07-23T15:00:30Z")

</div>

I’m facing the same problem.  
I need to pass some parameters of the userTask to a thirdParty task manager .  
First I make a REST-call with the REST-connector to the Camunda8API REST endPoint `/v2/user-tasks/search` to get the active userTasks by processInstanceKey. I tried putting the parameters (JSON) into customHeaders, but in the response to the query I get them back with escape characters for every " and I couldn’t parse this escaped JSON in FEEL.  
Example:  
header1 in Modeler is `{"TaskResult":4}`  
But the output is  
`"customHeaders": {"header1": "{\"TaskResult\":4}"}`  
so I can’t access it like `message.body.items[1].customHeaders.TaskResult`

```auto
{
  "items": [
    {
      "key": "2251799863357118",
      "elementInstanceKey": "2251799863357117",
      "processDefinitionKey": "2251799863354847",
      "processInstanceKey": "2251799862909211",
      "state": "CREATED",
      "elementId": "Activity_09e7dov",
      "processDefinitionId": "BidFactoring",
      "creationDate": "2025-07-22T17:46:16.900+0000",
      "tenantIds": "<default>",
      "externalFormReference": "4422922",
      "processDefinitionVersion": 14,
      "customHeaders": {
        "header1": "{\"TaskResult\":4}"
      },
      "priority": 50
    }
  ],
  "page": {
    "totalItems": 1,
    "firstSortValues": [],
    "lastSortValues": [
      2251799863357118
    ]
  }
}

```

I have also tried to put the parameters into a local variable, but sometimes I don’t get the values of variables from tasklist REST `/v1/tasks/:taskId/variables/search` when querying because the variables have not jet been processed in ElasticSearch indices by the time the taskId itself is already available through `/v1/tasks/search`. So this method of passing task parameters is unreliable - the task is already available but its local variables are sometimes not available jet and there is no way to know when the are finally available for querying.

So it would be nice if ether FEEL could parse an escaped JSON (string) into a context or if the Camunda8API REST endPoint `/v2/user-tasks/search` would output JSON values of customHeaders as JSON and not as a sting (escaped JSON)

---

<div class="post-metadata">

**Author:** ![nathan.loding](https://forum.camunda.io/user_avatar/forum.camunda.io/nathan.loding/32/24171_2.png) [@nathan.loding](https://forum.camunda.io/u/nathan.loding)\
**Post date:** [July 23, 2025, 3:09pm UTC](https://forum.camunda.io/t/feel-expression/47520/9 "2025-07-23T15:09:07Z")

</div>

@igormsk - I agree. Could you please comment on and upvote this GitHub issue, and I will this feedback with our product management team as well!

> <https://github.com/camunda/feel-scala/issues/825>
>
> \*\*Is your feature request related to a problem? Please describe.\*\*
> When use the… REST connector to call a service, i got the response like below.
> Now i need to extract the \`taskTodoList\` into an array to the result expression.
> 
> \`\`\`
> {
> "status": 200,
> "headers": {
> "date": "Fri, 12 Apr 2024 01:29:49 GMT",
> "server": "nginx",
> "transfer-encoding": "chunked",
> "x-content-type-options": "nosniff",
> "x-xss-protection": "1; mode=block",
> "x-frame-options": "SAMEORIGIN",
> "content-type": "application/json;charset=utf-8",
> "connection": "keep-alive",
> "strict-transport-security": "max-age=172800; includeSubDomains"
> },
> "body": {
> "RESPONSE": {
> "RETURN\_CODE": "S",
> "RETURN\_DATA": "{\\"taskTodoList\\":\[{\\"activityDefId\\":\\"obj\_ca954d098ba000018cd81cfdc2602910\\",\\"activityDefName\\":\\"startTask\\",\\"activityModelExt\\":{\\"customUniqueId\\":\\"\\",\\"extendProperty\\":\\"\\",\\"id\\":\\"obj\_ca954d098ba000018cd81cfdc2602910\\",\\"name\\":\\"startTask\\",\\"no\\":1,\\"sequential\\":-1},\\"activityType\\":\\"userTask\\",\\"async\\":false,\\"beginEngineNode\\":\\"2406:440:600::16e0:10018\\",\\"beginTime\\":1712885389000,\\"claimResourceId\\":\\"\\",\\"claimType\\":0,\\"controlState\\":\\"active\\",\\"customUniqueId\\":\\"\\",\\"delayTimes\\":0,\\"delegateUser\\":\\"\\",\\"dispatchId\\":\\"4a9cf601-b664-4cda-8581-ead5814ac6a0\\",\\"eAITask\\":false,\\"ext1\\":\\"\\",\\"ext2\\":\\"\\",\\"ext3\\":\\"\\",\\"ext4\\":\\"\\",\\"ext5\\":\\"\\",\\"ext6\\":\\"\\",\\"ext7\\":0,\\"ext8\\":0.0,\\"historyTask\\":false,\\"iOBD\\":\\"\\",\\"iOC\\":\\"\\",\\"iOR\\":\\"\\",\\"iOS\\":\\"\\",\\"id\\":\\"2c8eebfa-7f16-4c14-8f70-bd660d65e510\\",\\"monitor\\":false,\\"owner\\":\\"admin\\",\\"ownerDepartmentId\\":\\"5bc3a2dc-3bd2-4376-bcc3-5612e28e55fe\\",\\"ownerName\\":\\"admin\\",\\"parentTaskInstId\\":\\"00000000-0000-0000-0000-000000000000\\",\\"priority\\":1,\\"processDefId\\":\\"obj\_1b01dfade2fd4c408f6426ee290743d0\\",\\"processDefVerId\\":\\"obj\_1b01dfade2fd4c408f6426ee290743d0\\",\\"processGroupId\\":\\"obj\_f953af04fb5944ca8128e262d363f62c\\",\\"processInstId\\":\\"e4710d5c-9078-4a47-8868-4d43805d5d23\\",\\"readState\\":0,\\"remindTimes\\":0,\\"root\\":true,\\"scopeId\\":\\"00000000-0000-0000-0000-000000000000\\",\\"securityLevel\\":0,\\"state\\":1,\\"target\\":\\"admin\\",\\"targetCompanyId\\":\\"8911e732-b42a-4556-853f-ad32761bcbee\\",\\"targetDepartmentId\\":\\"5bc3a2dc-3bd2-4376-bcc3-5612e28e55fe\\",\\"targetName\\":\\"admin\\",\\"targetRoleId\\":\\"d102c89d-55f3-4865-9d5c-c00b7f47b803\\",\\"targetRoleNo\\":\\"\\",\\"taskInfo\\":\\"\\",\\"title\\":\\"Test Zeebe Rest connector\\",\\"trash\\":true}\],\\"processInstId\\":\\"e4710d5c-9078-4a47-8868-4d43805d5d23\\"}",
> "RETURN\_DESC": "sucess",
> "RETURN\_STAMP": "2024-04-12 09:29:49:022"
> }
> }
> }
> \`\`\`
> 
> As discuss in the forum:
> \[How to get the taskTodoList from the response body\](https://forum.camunda.io/t/how-to-get-the-tasktodolist-from-the-response-body/51773)
> \[Parse a json string to FEEL context\](https://forum.camunda.io/t/parse-a-json-string-to-feel-context/44755)
> 
> \*\*Describe the solution you'd like\*\*
> A new built-in function to handle the JSON string like \`JSON.parse()\`.
> 
> \`\`\`
> // Function signature
> from json(json: string): Any
> 
> // Examples
> // 1) JSON object to FEEL context
> from json("{\\"a\\": 1, \\"b\\": 2}")
> // {a: 1, b: 2}
> 
> // 2) JSON literal to FEEL value
> from json("1")
> // 1
> 
> from json("\\"a\\"")
> // "a"
> 
> from json("true")
> // true
> 
> from json("null")
> // null
> 
> // 3) JSON array to FEEL list
> from json("\[1, 2, 3\]")
> // \[1, 2, 3\]
> 
> // 4) JSON string of a date/time/date-time to FEEL string 
> from json("\\"2023-06-14\\"")
> // "2023-06-14" 
> 
> from json("\\"14:55:00\\"")
> // "14:55:00" 
> 
> from json("\\"2023-06-14T14:55:00\\"")
> // "2023-06-14T14:55:00" 
> 
> // 5) JSON string of a duration to FEEL string 
> from json("\\"P1Y\\"")
> // "P1Y" 
> 
> from json("\\"PT2H\\"")
> // "PT2H" 
> 
> // 6) invalid JSON to FEEL null 
> from json("invalid")
> // null 
> \`\`\`
> 
> \*\*Related issues\*\*
> 
> \* https://github.com/camunda/feel-scala/issues/602
> \* Camunda Autormation Platform 7: 
> \* Zeebe broker: 
> \* OMG issues:
> \* https://issues.omg.org/browse/DMN16-68
> \* https://issues.omg.org/browse/DMN15-102

---

<div class="post-metadata">

**Author:** ![igormsk](https://forum.camunda.io/letter_avatar_proxy/v4/letter/i/0ea827/32.png) [@igormsk](https://forum.camunda.io/u/igormsk)\
**Post date:** [July 24, 2025, 8:59am UTC](https://forum.camunda.io/t/feel-expression/47520/10 "2025-07-24T08:59:25Z")

</div>

done - thank you
