Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

tSAPInput: Write JSON with multiple rows in table output

Hi 0683p000009MACn.png
after my https://community.talend.com/t5/Design-and-Development/resolved-tSAPInput-Merge-Outputs/td-p/57216 was sloved, i stuck at the next step: Parsing the SAP output into JSON.
The outputs with the type output_structure are easy. Not so easy is the type output_table. This may contains more than one rows. Talend iterate now over all data rows and executing all components in the chain many-times.
My question is now: What is the best way to write this data rows into JSON?

Here is my job:
0683p000009MAuz.png

Example:
SAP returns the following table:
 ID         | Name           | Info
------------------------------------------------------
01         | Test           | My Info #1
02         | Test #2        | My Info #2


Expected JSON:

{"RESULT":}


Thank you very much! 0683p000009MACn.png
"Talend Open Studio for ESB"
Version: 5.5.1
Build id: r118616-20140617-1132
Labels (3)
4 Replies
Anonymous
Not applicable
Author

Hi,
Here is a component TalendHelpCenter:tWriteJSONField which transforms the incoming data into JSON fields.
Best regards
Sabrina
Anonymous
Not applicable
Author

Hi,
Here is a component TalendHelpCenter:tWriteJSONField which transforms the incoming data into JSON fields.
Best regards
Sabrina

Hi Sabrina,
i already use this component and it works well. My problem is, that the tSapInput component returns a output_table (which contains many data rows). I need to create a JSON Array containing all data rows from the SAP output.
This JSON Array must be a part of a JSON String which is generated from the other SAP Outputs.

Lets say SAP returns the following data:
A table ( output_table, contains 0..n rows):
 ID         | Name           | Info
------------------------------------------------------
01 | Test | My Info #1
02 | Test #2 | My Info #2


And a structure ( output_structure, contains only one row):
CustomerName=Bond
CustomerPrename=James


Expected JSON:
{"CustomerName":"Bond","CustomerPrename":"James","tableOutput":}


With the tWriteJSONField it no problem for me to create a JSON from the structure. I have only trouble with the table.

Thanks!
Anonymous
Not applicable
Author

Here an example:
0683p000009MAbU.png
0683p000009MAv4.png
I don't want 5 JSON Strings (see what tLogRow gets). I want one JSON String with an Array inside. How can I do this with talend?

Thank you very much!

I have now the same problem as clorenz ( http://www.talendforge.org/forum/viewtopic.php?pid=112669) one year ago.
Anonymous
Not applicable
Author

Hi,
I have an issue somewhat similar to the one mentioned here.
I am trying to create an array of json records out of a tsv file but this particular array element has values separated by commas.
I want the following structure:
,
12            "parentGroupId": "790"
13        }
14    ]
Here, I want the square brackets surrounding the mediaTypes element and the values "Online", "Print" come from a single column of a tsv file.


Is this possible?
Thank you.
0683p000009MAv9.png