When building a destination object array with Mapper 2.0 , you can customize the settings for each object within the array. To create a destination object array, give the destination object a name and set its data type to [object].
In the Source field, enter the JSON path to each source object (or object array) that you want to include in the destination object array separated by commas.
In this example, the destination object array references two objects and an object array from the source data:
-
$.companies
(source object) -
$.location
(source object) -
$.social_profiles.data[*]
(source object array)
Each object in the destination object array is represented as a tab for you to independently configure. Click Settings () to define how each object will be mapped.
Use these steps to copy a source object to the destination object array without changing the structure of the object. In this example, the first object ($.companies
) will be copied from the source data as-is, and if the source field has no value, "null" will be the default value.
-
Verify that the $.companies tab is selected.
-
Set the Copy an object array from the source as-is to Yes.
-
Select Use null as default value from the Action to take if source field has no value drop-down list.
If you save these settings and return to Mapper 2.0, you are unable to modify the settings for this object since it is set to be copied as-is.
On preview, the Output window displays the first object in the ExampleObjectArray
exactly as it is in the source data:
"ExampleObjectArray": [ { "type": "list", "data": [], "url": "/contacts/5fe44bcb4996d972d30c6f5e/companies", "total_count": 0, "has_more": false },
Use these steps to build a custom object in the destination object array using fields from an object in the source data. In this example, the second object in the destination object array is the object $.location
.
-
Verify that the $.location tab is selected.
-
Set the Copy an object array from the source as-is to No.
If you save these settings and return to Mapper 2.0, you can add all fields included in this object.
In this example, the second object in the destination object array will have three string fields: Country , Region , and City. These three fields are automatically added to all other objects in the destination object array, but none of the other objects have source fields mapped.
On preview, the Output window displays the second object in the ExampleObjectArray
customized according to our preferences:
"ExampleObjectArray": [ { "type": "list", "data": [], "url": "/contacts/5fe44bcb4996d972d30c6f5e/companies", "total_count": 0, "has_more": false }, { "Country": "India", "Region": "Telangana", "City": "Hyderabad" }
The third object in the ExampleObjectArray
references the $.social_profiles.data[*]
source object array for its data. Notice that since we've previously added three string fields to the $.location
object, this third object already has those three fields added.
Since most object arrays use parallel field structures accross all objects, any field you add to an object in a destination object array is automatically added to all other objects in that object array. You will still have to map each field in every object to a specific source, and you can manually delete any field from any object in the object array.
Comments
Please sign in to leave a comment.