Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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! 🙂
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?
@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.