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