Skip to content
Get in touch

Mapping

A schema for mapping data from one schema to another.

The following mapping:

{
"id": { "const": "123" },
"opportunity": {
"status": {
"switch": {
"field": "summary.opportunity_status",
"case": { "active": "open", "inactive": "closed" },
"default": "custom"
}
},
"amount": { "field": "summary.opportunity_amount" }
}
}

A JSON example of this model.

{
"id": { "const": "123" },
"opportunity": {
"status": {
"switch": {
"field": "summary.opportunity_status",
"case": { "active": "open", "inactive": "closed" },
"default": "custom"
}
},
"amount": { "field": "summary.opportunity_amount" }
}
}

A function for mapping data from one schema to another.

Sub-typeDescription
MappingConstantFunctionReturns a constant value.
MappingFieldFunctionReturns the value of a field in the source data.
MappingSwitchFunctionReturns a new value based on the value of a field in the source data using a switch-case lookup.

A JSON example of this model.

{
"id": {"const": "123"},
"name": {
"firstName": {"field": "first_name"},
"lastName": {"field": "last_name"},
},
}

Returns a constant value.

PropertyTypeDescription
conststringA constant value to add to the mapping.

A JSON example of this model.

{
"const": "123",
}

Returns the value of a field in the source data.

PropertyTypeDescription
fieldstringA dot-separated path to a field in the source schema whose value will be added to the mapping.

A JSON example of this model.

{
"field": "opportunity_status",
}

Returns a new value based on the value of a field in the source data using a switch-case lookup.

PropertyTypeRequiredDescription
switchobjectYesThe switch configuration object containing field, case, and optional default.

Where the switch configuration object has the following properties:

PropertyTypeRequiredDescription
fieldstringYesA dot-separated path to a field in the source schema whose value will be used for switching.
caseRecord<unknown>YesA mapping of source field values to desired output values.
defaultunknownNoThe default value to output if no case matches the source field value.

A JSON example of this model.

{
"switch": {
"field": "opportunity_status",
"case": {
"active": "open",
"inactive": "closed"
},
"default": "custom"
}
}