tRestResponse and JSON

One Star

tRestResponse and JSON

Hi!
Is it possible to return JSON in tRestResponse component? Xml works okay with tXmlMap component. But if we try to use tWriteJSONField component before tRESTResponse it does not work.. the tWriteJsonField component works okay if we log the data with tLogRow component..
Community Manager

Re: tRestResponse and JSON

Hi
You need to link tWriteJSONField to a tXMLMap component to map the result of tWriteJSONFiled to the body of tRESTResponse before tRESTResponse. Please see my screenshots.
Best reegards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: tRestResponse and JSON

Thanks for the answer Shong..
The answer is more simple than I Imagined.. You just have to use Accept: application/json as http header in http reguest and it works.. Use for example fiddler or curl in testing Smiley Happy No need to add json components to the job.. Smiley Happy
Community Manager

Re: tRestResponse and JSON

Thanks for the answer Shong..
The answer is more simple than I Imagined.. You just have to use Accept: application/json as http header in http reguest and it works.. Use for example fiddler or curl in testing Smiley Happy No need to add json components to the job.. Smiley Happy

ah, yes, I thought why do you need to write a Json string with tWriteJsonFiled.
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business