converting XML to JSON with multiple loop elements

One Star

converting XML to JSON with multiple loop elements

Hi All,
I need to convert a big XML with multiple loop elements in to JSON, please suggest me how to achieve it.
Currently I am able to convert simple XML to JSON with below design
tFileInputXML--main--tWriteJsonField--main-->tFileOutputDelimited
Please help me to understand how to achieve multiple loop elements.

example:
<student>
<name>john</name>
<class>8</class>
<age>12</age>
<subject>
<subject_name>Physics</subject_name>
<score>80</score>
<grade>B</grade>
<percentage>75%</percentage>
</subject>
<subject>
<subject_name>Chemistry</subject_name>
<score>85</score>
<grade>B</grade>
<percentage>82%</percentage>
</subject>
<address_details>
<address>
<address_type>Temp Address</address_type>
<address_1>main</address_1>
<address_2>India</address_2>
<address_3>Delhi</address_3>
</address>
<address>
<address_type>Permanent Address</address_type>
<address_1>main</address_1>
<address_2>USA</address_2>
<address_3>Newyork</address_3>
</address>
</address_details>
</student>
Community Manager

Re: converting XML to JSON with multiple loop elements

Hi
There are multiple loop elements (subject and address) in the source XML file, it is able to extract the data from all loop elements with tFileInputMSXML component, but it is impossible to create multiple loop elements with tWriteJsonField component. Right now, you can only generate a json file for each loop element.
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: converting XML to JSON with multiple loop elements

can we create a JSON with multiple loop in twritejson component in Talend open studio big data