Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

XML to JSON conversion

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.

Labels (4)
2 Replies
Anonymous
Not applicable
Author

Please check out tXmlToJson custom component in talend exchange center.

https://exchange.talend.com/#marketplaceproductoverview:marketplace=marketplace%252F1&p=marketplace%...
Graceleah4181
Contributor
Contributor

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.