输入.json
{
"accountType": "ADMIN",
"id": "aaab-ccc-ddd-eeeAAA",
"relationship": "DIRECT",
"accountInfo": {
"partyTypeCode": "PARTNER",
"source": "Facebbok",
"internalAccount": true,
"category": "Father"
},
"accountAddress": [
{
"addressId": "0016u00000bsqfrAddId",
"integrationId": "0016u00000bsqfrInt",
"addressType": "office",
"shipToAddress": "Y",
"soldToAddress": "N"
},
{
"addressId": "12316u00000bsqfrAddId",
"integrationId": "12316u00000bsqfrInt",
"addressType": "home",
"shipToAddress": "N",
"soldToAddress": "Y"
}
]
}
输出.json
{
"PostalAddress": {
"item": [
{
"key": {
"primaryKey": "0016u00000bsqfrAddId~HDADDRESS~Admin"
},
"PrimaryAddress": {
"addrTyp": "Y",
"addrDes": "PRIMARY"
},
"SecondaryAddress": {
"addrTyp": "N",
"addrDes": "SECONDARY"
}
}
]
}
}
上述输出的标准
[
{ //transfrom to lowercase
"operation": "modify-overwrite-beta",
"spec": {
"accountType": "=toLower"
}
},
{ //split all the characters
"operation": "modify-overwrite-beta",
"spec": {
"accountType": "=split('',@(1,&))"
}
},
{ //convert 1st character to uppercase
"operation": "modify-overwrite-beta",
"spec": {
"accountType": {
"[0]": "=toUpper"
}
}
},
{ //convert array back to string
"operation": "modify-overwrite-beta",
"spec": {
"accountType": "=join('',@(1,&))"
}
}, { //concat ids
"operation": "modify-overwrite-beta",
"spec": {
"accountAddress": {
"*": {
"Fprim": "=concat(@(1,addressId),'~HDADDRESS~',@(3,accountType))",
"Gprim": "=concat(@(1,integrationId),@(3,accountType))"
}
}
}
},
{
"operation": "shift",
"spec": {
"accountInfo": {
"source": {
"Facebook": { //if source is Facebook
"@4,accountAddress": {
"*": {
"Fprim": "PostalAdress.items[&1].key.primaryKey"
}
}
},
"Google": { //if source is Google
"@4,accountAddress": {
"*": {
"Gprim": "PostalAdress.items[&1].key.primaryKey"
}
}
}
}
},
"accountAddress": {
"*": {
"shipToAddress": "PostalAdress.items[&1].PrimaryAddress.addrTyp",
"#PRIMARY": "PostalAdress.items[&1].PrimaryAddress.addrDes",
"soldToAddress": "PostalAdress.items[&1].SecondaryAddress.addrTyp",
"#OPTIONAL": "PostalAdress.items[&1].SecondaryAddress.addrDes"
}
}
}
}
]