[resolved] unexpected format in tFileOutputJson output

Four Stars

[resolved] unexpected format in tFileOutputJson output

Hi,
I am getting invalid format in tFileOutputJson as below
{"data":}
Please refer to http://www.talendforge.org/forum/viewtopic.php?pid=132011#p132011 about input data and design.
Output on the console is correct output for the same job.
XMLSerializer INFO Using default type string
{"employee":{"id":"1","name":"Simon","lastname":"Tod","training":{"trainingCode":"AX2","trainingCost":"2345"}}}
How to correct output json file? I am using TOS5.3.
Thanks
Vaibhav

Accepted Solutions
Four Stars

Re: [resolved] unexpected format in tFileOutputJson output

Hi,
Following were small changes which needs to consider for getting correct json file.
1) Select the output column as training in tWriteJsonField which was the loop element in Json tree
2) Remove delimiter in tFileOutputDelimited use only "", else the file is pre or post fixed by delimiter for those many number of columns
Thanks
Vaibhav

All Replies
Community Manager

Re: [resolved] unexpected format in tFileOutputJson output

Hi Vaibhav
tFileOutputJson don't provide a GUI for configuring Json tree, this component is just designed to outputs a simple json file with only one data block, if you want to output a complex Json file, you need to use tWriteJsonField which provides a GUI for configuring complex Json tree, and link tWriteJsonField to a tFileOutputDelimited to output the result as a json file. For example:
tFixedFlowInput--main--tWriteJsonField--main-->tFileOutputDelimited
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
Four Stars

Re: [resolved] unexpected format in tFileOutputJson output

Hi,
Following were small changes which needs to consider for getting correct json file.
1) Select the output column as training in tWriteJsonField which was the loop element in Json tree
2) Remove delimiter in tFileOutputDelimited use only "", else the file is pre or post fixed by delimiter for those many number of columns
Thanks
Vaibhav