cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Convert json to xml

karansawhney
New Contributor II

Hello,

I would like to know the best way to convert json list of accounts to an xml repeating element like below-

โ€œaccountsโ€:[
โ€œ10โ€,
โ€œ9โ€,
โ€œ8โ€,
โ€œ7โ€,
โ€œ6โ€,
โ€œ5โ€,
โ€œ4โ€,
โ€œ3โ€,
โ€œ2โ€,
โ€œ1โ€
]

to
ns1:AccountIds
ns2:long10</ns2:long>
ns2:long9</ns2:long>
ns2:long8</ns2:long>
ns2:long7</ns2:long>
ns2:long6</ns2:long>
ns2:long5</ns2:long>
ns2:long4</ns2:long>
ns2:long3</ns2:long>
ns2:long2</ns2:long>
ns2:long1</ns2:long>
</ns1:AccountIds>

1 REPLY 1

dimche_saveski
New Contributor III

Hello @karansawhney

You can convert json array to an xml repeating element with xml generator and Apache velocity template connected to mapper with a binary output view.
I created a pipeline from your example , you can check it .
test2_2020_03_31.slp (4.8 KB)

Best regards
Dimche