
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Empty string value is output as empty array
Hi,
I am using tWriteJSONField to output JSON. Problem I am facing is whenever a string comes with null value, it is stored as [] ie "emtpy array" , although it should be "" i.e. "empty string", ARE there any fixes Talend has provided for this issue? I can do a simple find and replace, but wondering if there is any configuration or available fix for this. I am using Talend Studio 6.3.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Here is a related jira issue:https://jira.talendforge.org/browse/TDI-31237.
Could you please check it to see if it is what you are looking for?
Best regards
Sabrina

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Xiaodi Shi ,
Came across this issue.
When I log it "site_id" shows empty.
When I use twritejsonfield and out to a json file it changes to empty [].
Any solution for this?
Thank you

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
HI @Heshan Karunaratneyou could try to play with advanced option of the component like pass empty string or null value explicitly else you could try to add a tJavaRow after the tWriteJsonfield then in the tjavaRow :
output_row.string = input_row.string.replaceAll("\\[\\]","\"\"");
it will replace [] by ""
here i assume your json schema field name is string
Send me love and kudos

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, For 50% this option is ok.
output_row.string = input_row.string.replaceAll("\\[\\]","\"\"");
But in my json object there are specific arrays and objects as well. For an empty array [] is fine.
Im specifically replacing them first and doing the rest to the others.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
you could focus on specific field like input_row.string.replaceAll("\"site_id\":\\[\\]","\"site_id\":\"\"");
