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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

JSON issue not compliant output (Curl - JSON - tREST - TALEND)

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

Labels (5)
13 Replies
Anonymous
Not applicable
Author

Change the  tFileOutputJson component with a tFileOutputRaw component. Then do not open the file with Notepad. This works.

Anonymous
Not applicable
Author

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. 

Anonymous
Not applicable
Author

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

Anonymous
Not applicable
Author

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.