04-12-2017 12:00 AM
Before 2017 Winter Release, transforming a Reltio REST API response JSON object into a simple structure can be a tedious task. The expression library feature from 2017 Winter Release can make it much easier. Encouraged by @dmiller, am sharing a pipeline to showcase this technique. In this fictional scenario, the ask is that only output the Mobile phone fields.
Attached:
Community posting expression library for condensing Reltio REST API response_2017_04_12.slp (7.6 KB)
reltio.expr.txt (136 Bytes)
Fake_Reltio API response.json.txt (3.1 KB)
Phone.json.txt (288 Bytes)
How to test the example pipeline:
Content of the expression library file:
{
ov: y => y.find(x => x.ov == true).value,
findByType: (x,type) => x.find(y => this.ov(y.value.Type) == type && y.ov == true)
}
Pipeline property tab:
Pipeline:
First mapper:
Second mapper:
Condensed data from the output:
[
{
"uri": "entities/geFfGTn",
"updatedTime": 1492024546326,
"attributes": {
"FirstName": "Gr",
"LastName": "Moun",
"Gender": "Male",
"Phone": {
"CountryCode": "+1",
"Number": "9999990003",
"Type": "Mobile"
}
}
}
]
The input Reltio API response JSON looked like this:
[
{
"uri": "entities/geFfGTn",
"updatedTime": 1492024546326,
"attributes": {
"FirstName": [
{
"type": "configuration/entityTypes/Individuals/attributes/FirstName",
"ov": true,
"value": "Gr",
"uri": "entities/geFfGTn/attributes/FirstName/sv4pKXS0"
}
],
"LastName": [
{
"type": "configuration/entityTypes/Individuals/attributes/LastName",
"ov": true,
"value": "Moun",
"uri": "entities/geFfGTn/attributes/LastName/sv4pKfyW"
}
],
"Gender": [
{
"type": "configuration/entityTypes/Individuals/attributes/Gender",
"ov": true,
"value": "Male",
"lookupCode": "M",
"lookupRawValue": "M",
"uri": "entities/geFfGTn/attributes/Gender/19BWhlRa3"
}
],
"Phone": [
{
"label": "Mobile 9999990003",
"value": {
"Type": [
{
"type": "configuration/entityTypes/Individuals/attributes/Phone/attributes/Type",
"ov": true,
"value": "Mobile",
"uri": "entities/geFfGTn/attributes/Phone/19BWhm8Cd/Type/19BWhmKzP"
}
],
"Number": [
{
"type": "configuration/entityTypes/Individuals/attributes/Phone/attributes/Number",
"ov": true,
"value": "9999990003",
"uri": "entities/geFfGTn/attributes/Phone/19BWhm8Cd/Number/19BWhmCSt"
}
],
"CountryCode": [
{
"type": "configuration/entityTypes/Individuals/attributes/Phone/attributes/CountryCode",
"ov": true,
"value": "+1",
"uri": "entities/geFfGTn/attributes/Phone/19BWhm8Cd/CountryCode/19BWhmGj9"
}
]
},
"ov": true,
"uri": "entities/geFfGTn/attributes/Phone/19BWhm8Cd"
},
{
"label": "Home 5193217654",
"value": {
"Type": [
{
"type": "configuration/entityTypes/Individuals/attributes/Phone/attributes/Type",
"ov": true,
"value": "Home",
"uri": "entities/geFfGTn/attributes/Phone/zUqfhOhP/Type/zUqfhSxf"
}
],
"Number": [
{
"type": "configuration/entityTypes/Individuals/attributes/Phone/attributes/Number",
"ov": true,
"value": "5193217654",
"uri": "entities/geFfGTn/attributes/Phone/zUqfhOhP/Number/zUqfhXDv"
}
],
"CountryCode": [
{
"type": "configuration/entityTypes/Individuals/attributes/Phone/attributes/CountryCode",
"ov": true,
"value": "+1",
"uri": "entities/geFfGTn/attributes/Phone/zUqfhOhP/CountryCode/zUqfhbUB"
}
]
},
"ov": true,
"uri": "entities/geFfGTn/attributes/Phone/zUqfhOhP"
}
]
}
}
]