These examples show how Mapper 2.0 shapes data between an export and an import: record to record, record to row, row to record, string to object, and numbering records that have no unique ID. Use them as patterns for your own mappings. Before you start, check the destination application's API documentation for the JSON structure its endpoint requires.
For the panel and its controls, see Map data with Mapper 2.0. For the difference between record and row structures, see Work with JSON and file output.
Record to record
Input and output both start and end with curly braces { }. Use this when the source sends one object and the destination expects one object.
- In JSON structure, select record { }.
- For each destination field, enter the name and select the data type. The data type sets the structure and formatting of the output.
- For each destination field, select the source field.
- Select Preview. The Output pane shows the record that integrator.io sends.
Record to row
The input starts and ends with curly braces { }, and the output starts and ends with brackets [ ]. Use this when the source sends one object and the destination expects an array of objects.
- In JSON structure, select rows [ ].
- Add each destination field, data type, and source field as in the record-to-record example.
- Select Preview to check the output.
Row to record
The input starts and ends with brackets [ ], and the output starts and ends with curly braces { }. Use this when the source sends an array of objects and the destination expects one object.
- In JSON structure, select record { }.
- Add each destination field, data type, and source field.
- Select Preview to check the output.
Enter the source path yourself, such as $[0].sku. The source field list suggests $.sku, which returns an empty record when the input is an array.
Convert a string to an object
Use this when a source field holds a JSON object as a string, for example the response of an AI agent, and the destination expects an object.
- Enter the destination field and set its data type to object.
- Select Settings
on the source field.
- Set Copy an object from the source as-is? to Yes.
- Change the source data type to string.
- Select Preview to check the output.
Index records with no unique IDs
Use automatic indexing when the items in an array don't have a unique ID. The index is the position of each item in the array, starting at 0. You can write it to a destination field, such as a store or department number.
- In the source column of the destination field, enter the path of the parent array followed by
.currentIndex(), for example$.items[*].currentIndex(). - Select Preview to check the numbering.
Limits:
-
currentIndex()returns the index of the immediate parent only. It can't reach a grandparent. - It can't reference sibling indexes.