02-17-2023 04:06 AM
hi there,
I have following json
[
{
"docname": [
"Coupa_Supplier_SB_Tax_Cert_PO_4501923290",
"Coupa_Supplier_SB_Tax_Cert_PO_450192323"
],
"id": 16758,
"docext": [
"pdf",
"pdf"
],
"IDOC": {
"@BEGIN": "1",
"EDI_DC40": {
"@SEGMENT": "1"
}
},
"docid": [
"FOL18 4 EXT48000000000776",
"FOL18 4 EXT480000000007236"
]
}
]
that i need to convert to
[
{
"attachments": [
{
"docname": "Coupa_Supplier_SB_Tax_Cert_PO_4501923290",
"id": 16758,
"docext": "pdf",
"docid": "FOL18 4 EXT48000000000776"
},
{
"docname": "Coupa_Supplier_SB_Tax_Cert_PO_450192323",
"id": 16758,
"docext": "pdf",
"docid": "FOL18 4 EXT480000000007236"
}
],
"IDOC": {
"@BEGIN": "1",
"EDI_DC40": {
"@SEGMENT": "1"
}
}
}
]
any help is greatly appreciated.
thanks
Manohar
Solved! Go to Solution.
02-17-2023 04:23 AM
Hi @manohar,
You can try by using Mapper Snap with the following expression for the attachments:
sl.range(0,$docname.length).map((x,ind) => {"docname":$docname[ind],"id":$id,"docext":$docext[ind],"docid":$docid[ind]})
Try with this, and let me know if this helps you.
BR,
Aleksandar.
02-17-2023 04:23 AM
Hi @manohar,
You can try by using Mapper Snap with the following expression for the attachments:
sl.range(0,$docname.length).map((x,ind) => {"docname":$docname[ind],"id":$id,"docext":$docext[ind],"docid":$docid[ind]})
Try with this, and let me know if this helps you.
BR,
Aleksandar.
02-17-2023 06:02 AM
wow!! you make it look so simple. thank you very much for your help.
Manohar