Combine multiple arrays
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
Yeah, I finally realized that Join snap cannot handle joining fields into same top-level structure so I eliminated the top level structure for the join, and then used a mapper to add the top-level structure back. I had to write a custom snap (not included) to prune off all the null fields/elements created by the Null Safe Access mappers…
I must say that was a lot more painful than I think it should be. If I were to use this in an actual business process, the logic of the business process flow would get lost due to this complex mapping flow…
Here is the final working example (with all of the nulls still present).
Mapping Conundrum_2020_09_30 (3).slp (56.6 KB)
Thanks for the help,
Robert