What are you trying to achieve?
I need to transform the options of second iteration in a array like:
[
{
"label": "small",
"value": "small"
},
{
"label": "medium",
"value": "medium"
},
{
"label": "large",
"value": "large"
}
]
But the array returned from API requested though RPC is:
[ "large", "medium", "small" ]
Below is the RPC definition
{
"url": "/agents/{{parameters.agentId}}",
"method": "GET",
"response": {
"iterate": "{{body.questions}}",
"output": {
"name": "{{item.name}}",
"label": "{{item.name}}",
"type": "{{if(item.type === 'select', 'select', 'text')}}",
"required": "{{item.required}}",
"description": "{{item.description}}",
"options": "{{item.options}}"
}
}
}
With the definition above Iām getting blank options:
The quantity of items is correct, but I cannot get the values properly.
And then I try this approach I got an error:
{
"url": "/agents/{{parameters.agentId}}",
"method": "GET",
"response": {
"iterate": "{{body.questions}}",
"output": {
"name": "{{item.name}}",
"label": "{{item.name}}",
"type": "{{if(item.type === 'select', 'select', 'text')}}",
"required": "{{item.required}}",
"description": "{{item.description}}",
"options": {
"iterate": "{{item.options}}",
"output": {
"name": "{{item}}",
"label": "{{item}}"
}
}
}
}
}