No, that’s not how join
works.
If there is only a single item in the array, nothing is “joined” with the separator.
So the output will be the single item in the array.
Feel free to test it yourself, I’ll leave the module export below:
Module Export
You can copy and paste this module export into your scenario. This will paste the modules shown in my screenshots above.
-
Copy the JSON code below by clicking the copy button when you mouseover the top-right of the code block
-
Enter your scenario editor. Press ESC to close any dialogs. Press CTRLV (paste keyboard shortcut for Windows) to paste directly in the canvas.
-
Click on each imported module and save it for validation. You may be prompted to remap some variables and connections.
JSON
{
"subflows": [
{
"flow": [
{
"id": 10,
"module": "json:ParseJSON",
"version": 1,
"parameters": {
"type": ""
},
"mapper": {
"json": "{\"Array\": [\n{\n \"dropdownOptionId\": 1234567, \n \"text\": \"North America\"\n}\n,{\n \"dropdownOptionId\": 9876543, \n \"text\": \"East Asia\"\n}\n]}"
},
"metadata": {
"designer": {
"x": -9,
"y": -858,
"name": "An array of collections"
},
"restore": {
"parameters": {
"type": {
"label": "Choose a data structure"
}
}
},
"parameters": [
{
"name": "type",
"type": "udt",
"label": "Data structure"
}
],
"expect": [
{
"name": "json",
"type": "text",
"label": "JSON string",
"required": true
}
]
}
},
{
"id": 11,
"module": "util:SetVariable2",
"version": 1,
"parameters": {},
"mapper": {
"name": "Output",
"scope": "roundtrip",
"value": "{{join(map(10.Array; \"text\"); space + \"&\" + space)}}"
},
"metadata": {
"designer": {
"x": 293,
"y": -858,
"name": "Join array with mapped property"
},
"restore": {
"expect": {
"scope": {
"label": "One cycle"
}
}
},
"expect": [
{
"name": "name",
"type": "text",
"label": "Variable name",
"required": true
},
{
"name": "scope",
"type": "select",
"label": "Variable lifetime",
"required": true,
"validate": {
"enum": [
"roundtrip",
"execution"
]
}
},
{
"name": "value",
"type": "any",
"label": "Variable value"
}
],
"interface": [
{
"name": "Output",
"type": "any",
"label": "Output"
}
]
}
}
]
}
],
"metadata": {
"version": 1
}
}
Run it once, observe the output.
Delete the second item in the array, and run it again.