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

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?

Accepted Solutions
Sixteen 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.

All Replies
Sixteen 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.
One Star

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

Thanks, this seems to have worked.
Five Stars mr
Five Stars

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

rhall_2_0 suggestion worked for me. thanks.

Tutorial

Introduction to Talend Open Studio for Data Integration.

Definitive Guide to Data Integration

Practical steps to developing your data integration strategy.

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.