A mapping set is a set of mappings that transforms data from one schema to another. This document provides information on how mapping sets are comprised, including input schema, output schema, and mappings.
This overview requires a working understanding of the following components of Adobe Experience Platform:
A mapping set is comprised of an ID, name, input schema, output schema, and a list of associated mappings.
The following JSON is an example of a typical mapping set:
{
"id": "cbb0da769faa48fcb29e026a924ba29d",
"name": "Demo Mapping Set",
"inputSchema": {
"id": "a167ff2947ff447ebd8bcf7ef6756232",
"version": 0
},
"outputSchema": {
"schemaRef": {
"id": "https://ns.adobe.com/{TENANT_ID}/schemas/6dd1768be928c36d58ad4897219bb52d491671f966084bc0",
"contentType": "application/vnd.adobe.xed-full+json;version=1"
}
},
"mappings": [
{
"sourceType": "ATTRIBUTE",
"source": "Id",
"destination": "_id",
"name": "Id",
"description": "Identifier field"
},
{
"sourceType": "ATTRIBUTE",
"source": "FirstName",
"destination": "person.name.firstName"
},
{
"sourceType": "ATTRIBUTE",
"source": "LastName",
"destination": "person.name.lastName"
}
]
}
Property | Description |
---|---|
id |
A unique identifier for the mapping set. |
name |
The name of the mapping set. |
inputSchema |
The XDM schema for the incoming data. |
outputSchema |
The XDM schema that the input data has will be transformed to conform to. |
mappings |
An array of field-to-field mappings from the source schema to the destination schema. |
sourceType |
For each listed mapping, its sourceType attribute indicates the type of source that is to be mapped. Can be one of ATTRIBUTE , STATIC , or EXPRESSION :
|
source |
For each listed mapping, the source attribute indicates the field that you want to map. More information about how to configure your source can be found in the sources overview. |
destination |
For each listed mapping, the destination attribute indicates the field, or the path to the field, where the value extracted from the source field will be placed. More information on how to configure your destinations can be found in the destination overview. |
mappings.name |
(Optional) A name for the mapping. |
mappings.description |
(Optional) A description of the mapping. |
In a mapping, the source
can be a field, expression, or a static value. Based on the source type given, the value can be extracted in various ways.
When mapping a field in columnar data, such as a CSV file, use the ATTRIBUTE
source type. If the field contains .
within its name, use \
to escape the value. An example of this mapping can be found below:
Sample CSV file:
Full.Name, Email
John Smith, js@example.com
Sample mapping
{
"source": "Full.Name",
"destination": "pi.name",
"sourceType": "ATTRIBUTE"
}
Transformed data
{
"pi": {
"name": "John Smith"
}
}
When mapping a field in nested data, such as a JSON file, use the ATTRIBUTE
source type. If the field contains .
within its name, use \
to escape the value. An example of this mapping can be found below:
Sample JSON file
{
"customerInfo": {
"name": "John Smith",
"email": "js@example.com"
}
}
Sample mapping
{
"source": "customerInfo.name",
"destination": "pi.name",
"sourceType": "ATTRIBUTE"
}
Transformed data
{
"pi": {
"name": "John Smith"
}
}
When mapping a field within an array, you can retrieve a specific value by using an index. To do this, use the ATTRIBUTE
source type and the index of the value you want to map. An example of this mapping can be found below:
Sample JSON file
{
"customerInfo": {
"emails": [
{
"name": "John Smith",
"email": "js@example.com"
},
{
"name": "Jane Smith",
"email": "jane@example.com"
}
]
}
}
Sample mapping
{
"source": "customerInfo.emails[0].email",
"destination": "pi.email",
"sourceType": "ATTRIBUTE"
}
Transformed data
{
"pi": {
"email": "js@example.com"
}
}
Using the ATTRIBUTE
source type, you can also directly map an array to an array or an object to an object. An example of this mapping can be found below:
Sample JSON file
{
"customerInfo": {
"emails": [
{
"name": "John Smith",
"email": "js@example.com"
},
{
"name": "Jane Smith",
"email": "jane@example.com"
}
]
}
}
Sample mapping
{
"source": "customerInfo.emails",
"destination": "pi.emailList",
"sourceType": "ATTRIBUTE"
}
Transformed data
{
"pi": {
"emailList": [
{
"name": "John Smith",
"email": "js@example.com"
},
{
"name": "Jane Smith",
"email": "jane@example.com"
}
]
}
}
Using the ATTRIBUTE
source type, you can iteratively loop through arrays and map them to a target schema by using a wildcard index ([*]
). An example of this mapping can be found below:
Sample JSON file
{
"customerInfo": {
"emails": [
{
"name": "John Smith",
"email": "js@example.com"
},
{
"name": "Jane Smith",
"email": "jane@example.com"
}
]
}
}
Sample mapping
{
"source": "customerInfo.emails[*].name",
"destination": "pi[*].names",
"sourceType": "ATTRIBUTE"
}
Transformed data
{
"pi": [
{
"names": {
"name": "John Smith"
}
},
{
"names": {
"name": "Jane Smith"
}
}
]
}
If you want to map a constant, or a static value, use the STATIC
source type. When using the STATIC
source type, the source
represents the hard-coded value that you want to assign to the destination
. An example of this mapping can be found below:
Sample JSON file
{
"name": "John Smith",
"email": "js@example.com"
}
Sample mapping
{
"source": "CUSTOMER",
"destination": "userType",
"sourceType": "STATIC"
}
Transformed data
{
"userType:": "CUSTOMER"
}
If you want to map an expression, use the EXPRESSION
source type. A list of accepted functions can be found in the mapping functions guide. When using the EXPRESSION
source type, the source
represents the function you want to resolve. An example of this mapping can be found below:
Sample JSON file
{
"firstName": "John",
"lastName": "Smith",
"email": "js@example.com"
}
Sample mapping
{
"source": "concat(upper(lastName), upper(firstName), now())",
"destination": "pi.created",
"sourceType": "EXPRESSION"
}
Transformed data
{
"pi": {
"created": "SMITHJOHNFri Sep 25 15:17:31 PDT 2020"
}
}
In a mapping, the destination
is the location where the value extracted from the source
will be inserted.
When you want to map the source
value to the root level of your transformed data, follow the example below:
Sample JSON file
{
"customerInfo": {
"name": "John Smith",
"email": "js@example.com"
}
}
Sample mapping
{
"source": "customerInfo.name",
"destination": "name",
"sourceType": "ATTRIBUTE"
}
Transformed data
{
"name": "John Smith"
}
When you want to map the source
value to a nested field in your transformed data, follow the example below:
Sample JSON file
{
"name": "John Smith",
"email": "js@example.com"
}
Sample mapping
{
"source": "name",
"destination": "pi.name",
"sourceType": "ATTRIBUTE"
}
Transformed data
{
"pi": {
"name": "John Smith"
}
}
When you want to map the source
value to a specific index in an array in your transformed data, follow the example below:
Sample JSON file
{
"customerInfo": {
"name": "John Smith",
"email": "js@example.com"
}
}
Sample mapping
{
"source": "customerInfo.name",
"destination": "piList[0]",
"sourceType": "ATTRIBUTE"
}
Transformed data
{
"piList": ["John Smith"]
}
When you want to iteratively loop through arrays and map the values to the target, you can use a wildcard index ([*]
). An example of this can be seen below:
{
"customerInfo": {
"emails": [
{
"name": "John Smith",
"email": "js@example.com"
},
{
"name": "Jane Smith",
"email": "jane@example.com"
}
]
}
}
Sample mapping
{
"source": "customerInfo.emails[*].name",
"destination": "pi[*].names",
"sourceType": "ATTRIBUTE"
}
Transformed data
{
"pi": [
{
"names": {
"name": "John Smith"
}
},
{
"names": {
"name": "Jane Smith"
}
}
]
}
By reading this document, you should now understand how mapping sets are constructed, including how to configure individual mappings within a mapping set. For more information on other Data Prep features, please read the Data Prep overview. To learn how to use mapping sets within the Data Prep API, please read the Data Prep developer guide.