Articles in this section

Mapper 2.0 examples

The following examples demonstrate how Mapper 2.0 handles record and row formatting between exports and imports.

Example 1: Record-to-record mapping

This example builds a destination app JSON record structure out of fields available in the source application’s JSON record structure data. This is a record-to-record mapping, meaning that the JSON structures for both input and output begin and end with curly braces {}.

Tip

When setting up your mapping configuration for data sent from your source app to your destination app, you should review the API documentation for your destination app to find the JSON structure required by the destination endpoint.

The source application JSON data displays in the Input window in the upper right corner of the Mapper 2.0 interface.

ExampleRecord2RecordInput.png

Enter each Destination field name in the left column, select its data type , and use the Source field drop-down list from the right column to select the field from your source data that will populate the import data. The data type you select determines the structure and field formatting displayed in the Output window when you click Preview. You can drag and drop lines to rearrange the order of fields, but you can't drag and drop a field to another level of the JSON hierarchy.

ExampleRecordToRecord.png

The above configuration creates the following output record displayed in the Output window in the lower right corner of the Mapper 2.0 interface.

ExampleRecord2RecordOutput.png

Click Preview to update the JSON data based on your most recent configuration, or check Auto-preview to automatically update the output with each change you make.

Example 2: Record-to-row mapping

This example builds a destination app JSON row structure out of fields available in the source application’s JSON record structure data. This is a record-to-row mapping, meaning that the input JSON structures begin and end with curly braces {}, and the output JSON structures begin and end with brackets [].

Tip

When setting up your mapping configuration for data sent from your source app to your destination app, you should review the API documentation for your destination app to find the JSON structure required by the destination endpoint.

The source application JSON data displays in the Input window in the upper right corner of the Mapper 2.0 interface.

recordToRowInput.png

Enter each Destination field name in the left column, select its data type , and use the Source field drop-down list from the right column to select the field from your source data that will populate the import data. The data type you select determines the structure and field formatting displayed in the Output window when you click Preview. You can drag and drop lines to rearrange the order of fields, but you can't drag and drop a field to another level of the JSON hierarchy.

ExampleRecordToRows.png

The above configuration creates the following output record displayed in the Output window in the lower right corner of the Mapper 2.0 interface.

recordToRowOutput.png

Click Preview to update the JSON data based on your most recent configuration, or check Auto-preview to automatically update the output with each change you make.

Example 3: Row-to-record mapping

This example builds a destination app JSON record structure out of fields available in the source application’s JSON row structure data. This is a row-to-record mapping, meaning that the input JSON structures begin and end with brackets [], and the output JSON structures begin and end with curly braces {}.

Tip

When setting up your mapping configuration for data sent from your source app to your destination app, you should review the API documentation for your destination app to find the JSON structure required by the destination endpoint.

The source application JSON data displays in the Input window in the upper right corner of the Mapper 2.0 interface.

rowToRecordInput.png

Enter each Destination field name in the left column, select its data type , and use the Source field drop-down list from the right column to select the field from your source data that will populate the import data. The data type you select determines the structure and field formatting displayed in the Output window when you click Preview. You can drag and drop lines to rearrange the order of fields, but you can't drag and drop a field to another level of the JSON hierarchy.

rowToRecord.png

The above configuration creates the following output record displayed in the Output window in the lower right corner of the Mapper 2.0 interface.

rowToRecordOutput.png

Click Preview to update the JSON data based on your most recent configuration, or check Auto-preview to automatically update the output with each change you make.

Example 4: Convert string value to an object

This example builds a destination app JSON record structure out of string values available in the source application’s JSON data. This converts your string value into an object, meaning that the input JSON record structure contains a string value, and the destination application's JSON record structure contains curly braces {}.

This is particularly helpful if you're mapping source data from an AI agent to a destination.

Tip

When setting up your mapping configuration for data sent from your source app to your destination app, you should review the API documentation for your destination app to find the JSON structure required by the destination endpoint.

The source application's JSON data is displayed in the Input window in the upper-right corner of the Mapper 2.0 interface.

AI_string_mapper.png

Enter each Destination field name in the left column and select its data type. Open the Source field settings settings_gear.svg, check Copy an object from the source as-is, and change the source data type to string.

mapping_string_ai_config.png

The data type you select determines the structure and field formatting displayed in the Output window when you click Preview.

ai_mapper_string_output.png

You can drag and drop lines to rearrange the order of fields, but you can't drag and drop a field to another level of the JSON hierarchy.

Example 5: Index records with no unique IDs

Use automatic indexing in import mappings when the source data is missing unique IDs within an object array.

Automatic indexing adds a row number to each item in a repeating list. You can use the index in your mapping output and write it into target fields, such as a store or department index.

Implement the reserved JSON path function .currentIndex() to retrieve the current row number, which begins at 0.

.currentIndex() supports referencing the immediate parent index, meaning it can only go one level up. You can only pull the index from the parent directly above the child record. You cannot go multiple levels up the hierarchy (such as referencing a "grandparent" record). It does not support referencing sibling indexes.

index_mapping_3.png