Solved
Forum Discussion
deepak_shaw
4 years agoContributor
Hi @bojanvelevski ,
Just to clarify here are input & output messages:
input:
[
{
"Header": {
"InvoiceNumber": "PRP100418",
"InvoiceDate": "29/04/2022",
"PaymentTermsDescription": "Net 7 days",
"CustomerRef": "C1381"
},
"InvoiceLines": [
{
"LineNumber": "1",
"LineExtAmtExclTax": "7000",
"Employee": "Marlon Mangila",
"LineTax": "700"
},
{
"LineNumber": "2",
"LineExtAmtExclTax": "800",
"Employee": "Elin Joe",
"LineTax": "150"
}
]
}
]
output:
{
"Invoice": {
"InvoiceNumber": {
"@attributeName": "PRP100418",
"$": "C1381"
},
"InvoiceLines": [
{
"LineNumber": {
"@LineExtAmtExclTax": "7000",
"$": "1"
},
"value": "Marlon Mangila"
},
{
"LineNumber": {
"@LineExtAmtExclTax": "8000",
"$": "2"
},
"value": "Elin Joe"
}
]
}
}
Looking forward to your suggestion.
Regards,
Deepak.
bojanvelevski
4 years agoValued Contributor
Done, check the pipeline and let me know if this works for you. Can be made with multiple mappers or a JSON Schema as well, but this is simpler in terms of snaps usage.
- darshthakkar4 years agoValued Contributor
The format of .mapKeys is very vital as I tried the below formats and it completely changed what I wanted to achieve:
$.mapKeys((key,elem) => key+"_sfdc")
$.mapKeys((key,elem) => "sfdc_"+key)