Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I have a "tREST" component that I link to a tJSONoutput component
In the tREST I set up a cURL request, the request requests a URL and an "X-Auth-Token" in HTTP header
After that I get a JSON that contains all the metrics of my infrastructures on openstack
the concern is that the json is not the right format, it's a big package of unstructured data in JSON format.
The solution is to add "| python -mjson.tool" at the end of the cURL request.
Like this: curl -H "X-Auth-Token: XXXXXXXXXXXXXXXXXXXXXXXXXXXXX" "XXXXXXXXXXXXXXXXXXXXXX / servers / detail" | python -mjson.tool
This works very well on the bash github console, but I would like to use it on TALEND so that my tREST interopts openstack and generates a JSON with the GOOD FORMAT.
Thank you for your help ...
ahmed.daoudi.pro@gmail.com
Change the tFileOutputJson component with a tFileOutputRaw component. Then do not open the file with Notepad. This works.
You can do practically whatever you want in Talend. However doing what you're wanting to do is a little like putting a road inside a train.
thank you ! but your answer does not completely solve my problem! I used a tFileOutputRaw but indentation and line breaks were not taken into account. So I can't parser my json to extract information! help me please
Indentation and line breaks should not affect a true parser. Anyway, if you open the file using an application that does not ignore formatting (something like WordPad in Windows), you will see that it is formatted in a more readable fashion.
This is not a Talend issue, this is an interpretation issue.