Structure
On this Page
Overview
This Snap modifies the structure of an incoming document. It can reuse the source document's data or create new data structures (list/map). When the Snap reuses source data, all untouched values will be preserved after all the operations are executed; so a source path can be moved multiple times. However, a target path cannot be the target of a move, otherwise the pipeline will fail. In addition, if a source path is deleted, then the path will not exist after it is executed. Paths can also be updated and the original value will not be deleted.
If the source and target structures are the same, you do not need to use this Snap.
There are five cases for update:Â
Update value - the value is replaced
      Example:
 Source Data |  Pass Through |  Source Path |  Operation |  Target Path |  Target Data |
---|---|---|---|---|---|
{ first_name: "Joe", last_name: "Smith" } | Â Yes | Â $first_name | Â update | Â $last_name | { first_name: "Joe", last_name: "Joe" } |
Update map - key in map is updated
    Example:
 Source Data |  Pass Through |  Source Path |  Operation |  Target Path |  Target Data |
---|---|---|---|---|---|
{ first_name: "Joe", address: { street: "12 2nd Ave." } } | Â Yes | Â $first_name | Â update | Â $address | { first_name: "Joe", address: { first_name: "Joe", street: "12 2nd Ave." } } |
Update list - value is appended to list
    Example:
 Source Data |  Pass Through |  Source Path |  Operation |  Target Path |  Target Data |
---|---|---|---|---|---|
{ first_name: "Joe", names: [ "John", "Sally" ] } | Â Yes | Â $first_name | Â update | Â $names | { first_name: "Joe", names: [ "John", "Sally", "Joe" ] } |
Update list of maps - value is added to each map of the list
Note: If a list does not have all the same type scalar, map, or list, then the pipeline will fail.
    Example:
 Source Data |  Pass Through |  Source Path |  Operation |  Target Path |  Target Data |
---|---|---|---|---|---|
{ first_name: "Joe", customers: [ { last_name: "Smith", phone_num: "111-222-3333" }, { last_name: "Smith", phone_num: "123-456-7890" } ] } | Â Yes | Â $first_name | Â update | Â $customers | { first_name: "Joe", customers: [ { first_name: "Joe", last_name: "Smith", phone_num: "111-222-3333" }, { first_name: "Joe", last_name: "Smith", phone_num: "123-456-7890" } ] } |
Update list of lists - value is appended to the end of each list
Note: If a list does not have all the same type scalar, map, or list, then the pipeline will fail.
    Example:
 Source Data |  Pass Through |  Source Path |  Operation |  Target Path |  Target Data |
---|---|---|---|---|---|
{ first_name: "Joe", lists_of_lists: [ [ "Sue", "Sally"], [ "John", "Sam"] ] } | Â Yes | Â $first_name | Â update | Â $list_of_lists | { first_name: "Joe", lists_of_lists: [ [ "Sue", "Sally", "Joe"], [ "John", "Sam", "Joe"] ] } |
Snap Views
Input | This Snap has exactly one document input view. |
---|---|
Output | This Snap has exactly one document output view. |
Error | This Snap has at most one document error view and produces zero or more documents in the view. |
Support
Works in Ultra Pipelines.
Snap Settings
Label | Required. The name for the Snap. You can modify this to be more specific, especially if you have more than one of the same Snap in your pipeline. | |
---|---|---|
Pass Through | Required. Determine if data should be passed through or not. If set to yes, then the input data and its structure will be used. However, the output data structure can be changed by setting pass through to [None] - new map or [None] - new list. For example, if the input data is a key/value (map) structure, then the output structure can be changed to a list by setting pass through to [None] - new list and using target paths of list indices ($[0], $[1], $[2], etc).
Default value: Yes | |
Mapping Table | Required. Source path, operation, and target path to use in the Snap. Source path is the JSONPath to move/delete. Operation is the type of operation to execute (move/delete). Target path is the JSONPath to write a value to in a move operation. Source Path  | Operation | Target Path $first_name    |   move       | $name.first $phone_num   |   delete     |  $names[2]     |   delete     | $names[*].first | move     |  $first_names ÂDefault value:  none | |
Snap Execution | Select one of the three modes in which the Snap executes. Available options are:
Default Value: Execute only |
Example Output
 Source Data |  Pass Through | Null-safe access |  Source Path |  Operation |  Target Path |  Target Data |
---|---|---|---|---|---|---|
{ "first_name" : "John", "last_name": "Smith" } | Â Yes | Deselected | Â $first_name | move | Â $fname | [ { "last_name":"Smith", "fname":"John" } ] |
{ "first_name" : "John", "last_name": "Smith" } |  [None] - new map | Deselected |  $first_name | move |  $fname | [ { "fname":"John" } ] |
{ "first_name" : "John", "last_name": "Smith" } |  [None] - new list | Deselected |  $first_name | move | $[0].fname | [ [ { "fname": "John" } ] ] |
{ "first_name" : "John", "last_name": "Smith" } | Yes | Deselected | $mid_name | move | Â $middle | Â Pipeline fails |
{ "first_name" : "John", "last_name": "Smith" } |  Yes | Selected |  $mid_name | move | $middle | [ { "first_name": "John" "last_name": "Smith" "middle": null } ] |
{ "first_name" : "John", "last_name": "Smith" } | Â Yes | Deselected | Â $mid_name | Â delete | Â Pipeline fails | |
[ { "person":{ "first":"John", "last":"Smith" }, "id":2 } ] |  Yes | Deselected | $person.first | move | $first | [ { "person": { "last":"Smith" } "id":2, "first":"John" } ] |
{ "first_name" : "John", "last_name": "Smith" } | Â Yes | Selected | $first_name $first_name | move | $name1 $name2Â | [ Â { Â Â "last_name":"Smith", Â Â "name1":"John", Â Â "name2":"John" Â } ] |
{ "first_name" : "John", "mid_name" : "Alan", "last_name": "Smith" } | Yes | Deselected | $mid_name | delete | [ { "first_name":"John", "last_name":"Smith" } ] |