Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello Everyone,
I have one xml as input having multiple nested elements and I need to convert that xml into JSON document to load it into Couchbase using Talend. Below is my sample XML document.
<?xml version='1.0' encoding='UTF-8'?>
<xml>
<entities>
<entity id="5" version="123456">
<name>ABC</name>
<listCode>OF</listCode>
<address>MH INDIA</address>
<address>GJ INDIA</address>
<cd name="ID">1234</cd>
<cd name="SRC">XYZ</cd>
</entity>
</entities>
</xml>
Expected output:
"entity":{
"id":"5",
"version":"123456",
"name":"ABC",
"listCode":"OF",
"address": [{address1:"MH INDIA"},{address2:"GJ INDIA"}]
"sdf":[
{
"sdfvalue":"1234",
"sdfname":"ID"
},
{
"sdfvalue":"XYZ",
"sdfname":"Src"
}
]
}
I am getting output as 2 different JSON document, one for combination of "sdfvalue":"1234","sdfname":"ID" and second document for combination of "sdfvalue":"XYZ","sdfname":"Src" like below....
"entity":{
"id":"5",
"version":"123456",
"name":"ABC",
"listCode":"OF",
"address": [{address1:"MH INDIA"},{address2:"GJ INDIA"}]
"sdf":[
{
"sdfvalue":"1234",
"sdfname":"ID"
}
]
}
"entity":{
"id":"5",
"version":"123456",
"name":"ABC",
"listCode":"OF",
"address": [{address1:"MH INDIA"},{address2:"GJ INDIA"}]
"sdf":[
{
"sdfvalue":"XYZ",
"sdfname":"Src"
}
]
}
I want output in single JSON document. Can anyone suggest me few ideas to implement it in Talend.