lul
1
I have the following JSON as a string in a variable.
Through this would like to loop in Camunda
process:
This is my json String in variable favcolors:
{
"Tom":[
"green",
"yellow",
"blue"
],
"Tim":[
"purple",
"pink"
],
"John":[
"green"
],
"Peter":[
"black",
"white"
]
}
In the first loop, I want to go through the names only.
In the second loop through the respective colors of the persons.
What must the expression / collection in the loop be called?
My idea was the following:
Ich erhalte folgenden Fehler:
Error while evaluating expression: ${JSON(favcolors).elements()}. Cause: org.camunda.spin.json.SpinJsonDataFormatException: SPIN/JACKSON-JSON-01002 Expected ‘SpinList’, got ‘OBJECT’
I think the problem is with your Json. The persons are not elements in a list but fields in a json object.
I’d try something like
[
{
"Name": "Tom",
"Colors": [
"green",
"yellow",
"blue"
]
},
{
"Name": "Tim",
"Colors": [
"purple",
"pink"
]
},
{
"Name": "John",
"Colors": [
"green"
]
},
{
"Name": "Peter",
"Colors": [
"black",
"white"
]
}
]
1 Like
hassang
3
Hi @lul,
Kindly find attached a simplified running example
test-multiple-iter-process.bpmn (6.9 KB)
The collection expression of the outer loop is as illustrated in the below snip
And the collection expression of the inner loop is as follows
2 Likes
lul
4
Thanks for the hint with the json string. You are right!
lul
5
Wow thank you so much for your help. You could help to improve the understanding for me here.