[resolved] unexpected format in tFileOutputJson output

Highlighted
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

15TH OCTOBER, COUNTY HALL, LONDON

Join us at the Community Lounge.

Register Now

2019 GARNER 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

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Tutorial

Introduction to Talend Open Studio for Data Integration.

Watch