In this article
...
Learn More: Using the Mapping Table.
...
Examples
Removing Columns from Excel Files Using Mapper
...
You now need to write the updated data back into the SLDB as a JSON file. To do so, you add a JSON Formatter Snap to the Pipeline to convert the documents coming in from the Mapper Snap into binary data. You then add a File Writer Snap and configure it to write the input streaming data to the SLDB.
...
You can now view the saved file in the destination project in SnapLogic Manager.
...
Example Data Output
Successful Mapping
If your source data looks like:
...
Code Block |
---|
{ "full_name": "John Smith", "phone_num": "123-456-7890" } |
Unsuccessful Mapping
If your source data looks like:
...
Expression:
$middle_name.concat(" ", $last_name)
Target path:
$full_name
An error will be thrownis displayed.
Example
Escaping Special Characters in Source Data
...
If the Escape Character is | Use Expression | Sample Output | ||
---|---|---|---|---|
Single quote (') | JSON: $original.mapValues((value,key)=> value.toString().replaceAll("'","''")) OR $original.mapValues((value,key)=> value.toString().replaceAll("'","\''")) CSV: $[' Business-Name'].replace ("'","''") | |||
Ampersand (&) | JSON: $original.mapValues((value,key)=> value.toString().replaceAll("'","\&'")) OR $original.mapValues((value,key)=> value.toString().replaceAll("'","&'")) CSV: $[' Business-Name'].replace ("'","&'") | |||
Backslash (\) | JSON: $original.mapValues((value,key)=> value.toString().replaceAll("'","\\'"))
CSV: $[' Business-Name'].replace ("'","\\'") |
In this way, you can customize the data to be passed on to downstream Snaps using the Expression field in the Mapper Snap.
Refer to the Community discussion for more information.
See it in Action
The SnapLogic Data Mapper
Widget Connector | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
...
Community Links:
Insert excerpt | ||||||
---|---|---|---|---|---|---|
|