<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: tJavaRow replaceAll issue in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/tJavaRow-replaceAll-issue/m-p/2277818#M53475</link>
    <description>Hi&amp;nbsp;
&lt;BR /&gt;It seems tWriteJsonField generates some null value, this leads to the nullpointer exception on tjavarow, for testing, add a tlogrow after tWritejsonfield to print the output values on the console, to check if there exist null values.
&lt;BR /&gt;Regards
&lt;BR /&gt;Shong</description>
    <pubDate>Mon, 19 Sep 2016 16:57:40 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2016-09-19T16:57:40Z</dc:date>
    <item>
      <title>tJavaRow replaceAll issue</title>
      <link>https://community.qlik.com/t5/Talend-Studio/tJavaRow-replaceAll-issue/m-p/2277817#M53474</link>
      <description>Hello, I was trying to use tWriteJsonFiled to create a Nested Json and I am doing fine, except that the Json has an empty array where the value found to be null.
&lt;BR /&gt;I have tried to use tJavaRow to replace those empty array with a null or empty space, but I am getting a nullPointer exception. Need help with this. I am using Talend Open Studio 6.2.1 version.
&lt;BR /&gt;
&lt;B&gt;Example:&lt;/B&gt;
&lt;BR /&gt;Output of tWriteJsonField:
&lt;BR /&gt;"json": {
&lt;BR /&gt;"id": "2",
&lt;BR /&gt;"name": []
&lt;BR /&gt;}
&lt;BR /&gt;
&lt;B&gt;tJavaRow&lt;/B&gt;
&lt;BR /&gt;output_row.name = input_row.name.replaceAll("\\", "");
&lt;BR /&gt;If this is not the correct way to use, can someone please suggest good way to get rid of those empty Arrays.</description>
      <pubDate>Mon, 19 Sep 2016 16:23:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/tJavaRow-replaceAll-issue/m-p/2277817#M53474</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-09-19T16:23:55Z</dc:date>
    </item>
    <item>
      <title>Re: tJavaRow replaceAll issue</title>
      <link>https://community.qlik.com/t5/Talend-Studio/tJavaRow-replaceAll-issue/m-p/2277818#M53475</link>
      <description>Hi&amp;nbsp;
&lt;BR /&gt;It seems tWriteJsonField generates some null value, this leads to the nullpointer exception on tjavarow, for testing, add a tlogrow after tWritejsonfield to print the output values on the console, to check if there exist null values.
&lt;BR /&gt;Regards
&lt;BR /&gt;Shong</description>
      <pubDate>Mon, 19 Sep 2016 16:57:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/tJavaRow-replaceAll-issue/m-p/2277818#M53475</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-09-19T16:57:40Z</dc:date>
    </item>
    <item>
      <title>Re: tJavaRow replaceAll issue</title>
      <link>https://community.qlik.com/t5/Talend-Studio/tJavaRow-replaceAll-issue/m-p/2277819#M53476</link>
      <description>I have tried to put tlogRow after tWriteJsonField. 
&lt;BR /&gt;Here's what I wanted to do. 
&lt;BR /&gt;1. Connect to MySQL Database. 
&lt;BR /&gt;2. Get the records. 
&lt;BR /&gt;3. Transform the records by giving renaming them using tMap 
&lt;BR /&gt;4. Convert to Json for each row (Json should be nested). So I have used tWriteJsonField. 
&lt;BR /&gt;5. Send to REST API. 
&lt;BR /&gt;On step 4, I am not able to get the proper Json. It has the empty arrays, but no null values anywhere. That's the reason I thought of using the tJavaRow to replace the empty arrays with empty string. 
&lt;BR /&gt;If anyone has any better way for my series of steps, I really appreciate your help if you let me know. 
&lt;BR /&gt;Following is the response I have got by putting tLogRow after tWriteJsonField, but the tJavaRow gave a null pointer exception. Besides that, I am having some pipe symbols after each Json which is annoying. 
&lt;BR /&gt;I would also like to know if there is way to generate a nested Json without the name for the data block like "json" in the below response. 
&lt;BR /&gt;{ 
&lt;BR /&gt; "json": { 
&lt;BR /&gt; "id": "1", 
&lt;BR /&gt; "template_id": [], 
&lt;BR /&gt; "time": "2015-09-22 11:37:47", 
&lt;BR /&gt; "person_id": [], 
&lt;BR /&gt; "person1": { 
&lt;BR /&gt; "person1_email": "jon.doe@gmail.com", 
&lt;BR /&gt; "person1_first_name": "Jon", 
&lt;BR /&gt; "person1_last_name": "Doe", 
&lt;BR /&gt; "person1_mobile_phone": [] 
&lt;BR /&gt; }, 
&lt;BR /&gt; "person2": { 
&lt;BR /&gt; "person2_first_name": "Foo", 
&lt;BR /&gt; "person2_last_name": "Bar", 
&lt;BR /&gt; "person2_rep": "foo.bar@gmail.com", 
&lt;BR /&gt; "person2_mobile_phone": [] 
&lt;BR /&gt; } 
&lt;BR /&gt; } 
&lt;BR /&gt;} || || || || || || || || || || || || | { 
&lt;BR /&gt; "json": { 
&lt;BR /&gt; "id": "1", 
&lt;BR /&gt; "template_id": [], 
&lt;BR /&gt; "time": "2015-09-22 11:37:47", 
&lt;BR /&gt; "person_id": [], 
&lt;BR /&gt; "person1": { 
&lt;BR /&gt; "person1_email": "jon.doe@gmail.com", 
&lt;BR /&gt; "person1_first_name": "Jon", 
&lt;BR /&gt; "person1_last_name": "Doe", 
&lt;BR /&gt; "person1_mobile_phone": [] 
&lt;BR /&gt; }, 
&lt;BR /&gt; "person2": { 
&lt;BR /&gt; "person2_first_name": "Foo", 
&lt;BR /&gt; "person2_last_name": "Bar", 
&lt;BR /&gt; "person2_rep": "foo.bar@gmail.com", 
&lt;BR /&gt; "person2_mobile_phone": [] 
&lt;BR /&gt; } 
&lt;BR /&gt; } 
&lt;BR /&gt;}&amp;nbsp;</description>
      <pubDate>Tue, 20 Sep 2016 15:56:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/tJavaRow-replaceAll-issue/m-p/2277819#M53476</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-09-20T15:56:44Z</dc:date>
    </item>
    <item>
      <title>Re: tJavaRow replaceAll issue</title>
      <link>https://community.qlik.com/t5/Talend-Studio/tJavaRow-replaceAll-issue/m-p/2277820#M53477</link>
      <description>Hi&amp;nbsp; 
&lt;BR /&gt; 
&lt;PRE&gt;|| || || || || || || || || || || || |&lt;/PRE&gt; 
&lt;BR /&gt;What's this? It seems it generates duplicated records after&amp;nbsp; 
&lt;FONT size="2"&gt;&lt;FONT face="Verdana, Helvetica, Arial, sans-serif"&gt;tWriteJsonField. I confirm that the java code you used to replace empty array is right.&amp;nbsp;&lt;/FONT&gt;&lt;/FONT&gt; 
&lt;BR /&gt; 
&lt;FONT face="Verdana, Helvetica, Arial, sans-serif"&gt;&lt;FONT size="2"&gt;I think the data block like 'json' is the root node, you can remove it by checking the 'Remove root note' box on tWriteJsonField.&lt;/FONT&gt;&lt;/FONT&gt; 
&lt;BR /&gt; 
&lt;BR /&gt; 
&lt;FONT face="Verdana, Helvetica, Arial, sans-serif"&gt;&lt;FONT size="2"&gt;Regards&lt;/FONT&gt;&lt;/FONT&gt; 
&lt;BR /&gt; 
&lt;FONT face="Verdana, Helvetica, Arial, sans-serif"&gt;&lt;FONT size="2"&gt;Shong&lt;/FONT&gt;&lt;/FONT&gt;</description>
      <pubDate>Wed, 21 Sep 2016 10:04:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/tJavaRow-replaceAll-issue/m-p/2277820#M53477</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-09-21T10:04:34Z</dc:date>
    </item>
  </channel>
</rss>

