tWriteJSONField quotes numeric fields

One Star

tWriteJSONField quotes numeric fields

Dear folks,

it seems the component tWriteJSONField doesn't respect the data types of incoming columns and just writes all values in Strings.
My expectation is, that numeric values are not enclosed in quotes in the output of the component.

This causes me big trouble in a use-case, where I have to transform an Excel file with several columns to a JSON String, since the numeric values are all quoted and thus the application parsing the file fails...

I'm working with TOS 6.2.1.20160704_1411.

Are there any known workarounds?

Example Job:
JSON_EXAMPLE.zip.zip

Screenshot:

Ten Stars

Re: tWriteJSONField quotes numeric fields

According to the documentation: https://help.talend.com/search/all?query=tWriteJSONField
...the default type of all elements is String.  If you want an element to be numeric, you need to add an attribute named "type" and give it the static value of the type you want.
One Star

Re: tWriteJSONField quotes numeric fields

cterenzi wrote:
According to the documentation: https://help.talend.com/search/all?query=tWriteJSONField
...the default type of all elements is String.  If you want an element to be numeric, you need to add an attribute named "type" and give it the static value of the type you want.

Hi cterenzi,

thanks for your reply, this actually works fine.

However, if you have > 200 columns where you have to define the type like this, this can be a tough job ^^ But I guess there is no other possibility right now *lookingforthetrainee*.

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 2

Part 2 of a series on Context Variables

Blog

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