One Star

[resolved] Need to convert JSON string to document for use in tRESTClient

Hello,
In Talend Data Integration 5.6, I get the following error on compilation:
"Type mismatch: cannot convert from String to Document"
The context is this: I need to upload a JSON file with the following schema (note that the array "data" will contain up to 500 elements):
{
 "data":
}
I was unable to get the tWriteJSON field component to format the array correctly, so I was using that to define the subdocument, then passing that into tDenormalize & tMap to generate a string containing the full, correctly formatted JSON.
However, I need to sent this to a REST API, but the tRESTClient component seems to expect a document type. How can I convert my string to a document?
1 ACCEPTED SOLUTION

Accepted Solutions
Fifteen Stars

Re: [resolved] Need to convert JSON string to document for use in tRESTClient

Send the JSON string to the "string" input and not the "body" of the tRestClient. JSON is not a Document.
Rilhia Solutions
2 REPLIES
Fifteen Stars

Re: [resolved] Need to convert JSON string to document for use in tRESTClient

Send the JSON string to the "string" input and not the "body" of the tRestClient. JSON is not a Document.
Rilhia Solutions
One Star

Re: [resolved] Need to convert JSON string to document for use in tRESTClient

Thanks, this seems to have worked.