[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
Highlighted
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

View solution in original post


All Replies
Highlighted
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
Highlighted
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

View solution in original post

2019 GARTNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog