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.
If you are looking for a simple way to convert XML files to JSON Softaken XML Converter is a reliable solution. It is designed for users who want accurate results without technical steps. It can quickly read structured XML data and convert it into JSON files while preserving the original structure. Even large XML files can be processed smoothly without any issues. The interface is user-friendly making it suitable for both beginners and experienced professionals. It can handle multiple XML files at once saving time on bulk conversions.