tRESTResponse Sends a JSON string instead of JSON

One Star

tRESTResponse Sends a JSON string instead of JSON

Hi,
I've a job where a web service extract documents from a MongoDB and sends them as one JSON Document,
TMongoInput --> tXMLMap --> tRESTResponse
My problem is that the documents contains an array and tRESTResponse sends it as a JSON string....
  
 
Highlighted
One Star

Re: tRESTResponse Sends a JSON string instead of JSON

Screenshots
Sixteen Stars

Re: tRESTResponse Sends a JSON string instead of JSON

Talend does not convert JSON into a Document object. Only XML is handled as a Document by Talend. There are JSON Objects available in Java, but for some reason Talend doesn't use these. Possibly due to REST standards? There shouldn't be a problem sending an array in a JSON string format though.
One Star

Re: tRESTResponse Sends a JSON string instead of JSON


{msisdn": 320740071,"dep": "","profile_id": "","consumption": ""}I'm getting this result ! Consumption field is an array in the DB and the Web service is returning it like this !
Sixteen Stars

Re: tRESTResponse Sends a JSON string instead of JSON

That is an array in JSON. You need to look here and make use of the "Generate JSON Document" option on the Advanced Settings tab of your output component.
One Star

Re: tRESTResponse Sends a JSON string instead of JSON

Thank you for your answer, well i'm trying to read from Db not inserting in it ... the problem is in tRESTResponse component it's not able to send Complex JSON structure (with nested array)... i think it's a bug !  
Sixteen Stars

Re: tRESTResponse Sends a JSON string instead of JSON

The tRESTResponse component needs to be configured to return a String and not a Document for JSON.