Created 03-20-2020 08:25 AM
Json Input:
[
{
"BRANCH_CODE": "7Z3",
"CUST_AC_NO": "Z256VM3K6872CY1F8",
"AC_DESC": "437T7F97CET",
"CUST_NO": "RX1"
},
{
"BRANCH_CODE": "7Z3",
"CUST_AC_NO": "Z256VM3K6872CY1F8",
"AC_DESC": "437T7F97CET",
"CUST_NO": "RX1"
}
]
Expected Output:
[ {
"ExternalSystemIdentifier" : "Z256VM3K6872CY1F8",
"Fields" : {
"FLD0001" : "7Z3",
"FLD0002" : "RX1",
"FLD0003" : "437T7F97CET"
},
"InstitutionId" : "1"
}, {
"ExternalSystemIdentifier" : "Z256VM3K6872CY1F8",
"Fields" : {
"FLD0001" : "7Z3",
"FLD0002" : "RX1",
"FLD0003" : "437T7F97CET"
},
"InstitutionId" : "1"
} ]
Jolt Spec:
[
{
"operation": "shift",
"spec": {
"*": {
"BRANCH_CODE": "[&1].FLD0001",
"CUST_NO": "[&1].FLD0002",
"AC_DESC": "[&1].FLD0003"
}
}
},
{
"operation": "shift",
"spec": {
"*": {
"$": "[#2].ExternalSystemIdentifier",
"@": "[#2].Fields"
}
}
},
{
"operation": "default",
"spec": {
"*": {
"InstitutionId": "1"
}
}
}
]
Created 03-20-2020 12:34 PM
You can refer to the "Fields" output field explicitly instead of needing another shift:
[
{
"operation": "shift",
"spec": {
"*": {
"CUST_AC_NO": "[&1].ExternalSystemIdentifier",
"BRANCH_CODE": "[&1].Fields.FLD0001",
"CUST_NO": "[&1].Fields.FLD0002",
"AC_DESC": "[&1].Fields.FLD0003"
}
}
},
{
"operation": "default",
"spec": {
"*": {
"InstitutionId": "1"
}
}
}
]
Created 03-20-2020 12:34 PM
You can refer to the "Fields" output field explicitly instead of needing another shift:
[
{
"operation": "shift",
"spec": {
"*": {
"CUST_AC_NO": "[&1].ExternalSystemIdentifier",
"BRANCH_CODE": "[&1].Fields.FLD0001",
"CUST_NO": "[&1].Fields.FLD0002",
"AC_DESC": "[&1].Fields.FLD0003"
}
}
},
{
"operation": "default",
"spec": {
"*": {
"InstitutionId": "1"
}
}
}
]
Created 03-20-2020 02:09 PM
Thanks Alot @mburgess
Created 09-30-2020 10:53 AM
Please have a look at this spec as well!
[
{
"operation": "shift",
"spec": {
"*": {
"BRANCH_CODE": "[&1].Fields.FLD0001",
"CUST_NO": "[&1].Fields.FLD0002",
"AC_DESC": "[&1].Fields.FLD0003",
"CUST_AC_NO": "[&1].ExternalSystemIdentifier",
"#1": "[&1].InstitutionId"
}
}
}
]
Just FYI!