Search code examples
expressionactivitijuel

Is it possible to use a JSON Object as a Variable in Activiti and use specific Nodes as Variable


I want to use a JSON Object in the activity variable

so i have a declared JSON Object:

[
  "test.jpeg",
  "test.xml",
  "test_de2.mp4",
  "test_season.jpeg",
  "test_series.jpeg",
  "test_v05.mp4"
 ]

I put this as a process variable :

processVariables.put("result",jsonObject)

is it possible to acess a single element via the expression language?

like

${result[0]}

or something like this?

I tried a bit around but it did not work. I can't even find a good documentation for the expression language used in activity.


Solution

  • By default, the engine will assume it to be a String as there are currently no datatype for JSON in process variables. However, you can use JavaScript to parse your string to JSON.