'Splitting a string and mapping it to a JSON Array in Snaplogic
Afternoon. I am pulling fields out of salesforce using snaplogic and then calling a rest api with the results. One of the fields that I am mapping to the POST JSON Body needs to be an array. One of the fields that I am pulling out of salesforce is string that is semi-colon delimited. Looking at the snaplogic documentation there is a split(';') function that I can call. In the mapping snap I get this error whenever I try and add an expression to the end of the Salesforce field:
cannot lookup a property on a null value
Is there an example somewhere of splitting a string in a mapper snap and applying it to a rest html body? The documentation on the snaplogic site will verbose is nevertheless unhelpful.
Solution 1:[1]
You can use the split() method to output an array from the mapper snap.
Following is a sample pipeline:
Input JSON in the JSON generator:
[
{
"msg" : "Test 1;Test 2;Test 3"
}
]
All settings are left to default.
Mapper Snap:
Expression: $msg.split(';')
Output: [{"msg_array":["Test 1","Test 2","Test 3"]}]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Bilesh Ganguly |


