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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
unTalended
Contributor
Contributor

Approach transforming JSON to XML with Talend Open Studio for ESB

Hi @all 🙂

 

I am new at talend and struggling with following issue. Please be lenient with me.

 

The two main intentions are first to retransform a minified json string and second to transform a string with minified json to xml. I don't know which approach is expedient.

 

I searched for a solution but coudn't find unfortunately anything helpful:

 

My intended workflow should be:

Input (minified json string)

     |

     |-> Output (reordered minified json string) -> Conversation JsonToXML with other structure -> Saving in output.xml (local)

                                                                   |

                                                                   |------------------------------------------------------> Saving in output.json (local)

                                                                                                                                             (currently I'm saving it with tFileOutputRaw as *.json)

 

Input (minified json string):

{ "platforms": [ { "id": "platforms-id", "name": "platform-name", "stops": { "elements": [ { "id": "stop-id", "location": { "lat": lat-value,                  "lon": lon-value } }, … more stops ] } },
… more platforms ] }

 

 

Output (reordered minified json string) and also as result output.json (local)

{     "platforms-id": {         "id": "platforms-id",         "name": "platform-name",         "stops": [             {                 "id": "stop-id",                 "lat": lat-value,                 "lon": lon-value             },             … more stops         ]     }, … more platforms }

 

 

Result: output.xml (local)

<platforms>     <platform id="platforms-id" name="platform-name">         <stops>             <stop id="stop-id" lat="lat-value" lon="lon-value"></stop>             … more stops         </stops> </platform>
… more platforms </platforms>

 

 

What is the right approach to reach the goal? Which components I have to use?

 

I would be very grateful for your help! And excuse my bad english! 🙂

Labels (5)
3 Replies
manodwhb
Champion II
Champion II

@unTalended ,use the below way,

 

tFileInputXml-->tXMLMap-->tfileoutputDelimitted 

unTalended
Contributor
Contributor
Author

Hello @manodwhb 

thanks for your reply!

 

Unfortunately I don't understand your approach.

How can I use the tFileInputXml-component for my JSON minified string as source? Do I not have to transform it before reading it in? 

manodwhb
Champion II
Champion II

@unTalended , I thought it is a file which you are trying to convert into xml. if you are getting as string column then you need to use tExtractjson  inplace of tfileinput.