<?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 Null Pointer Exception When reading from JSON file in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Null-Pointer-Exception-When-reading-from-JSON-file/m-p/2287641#M61209</link>
    <description>&lt;P&gt;In the JSON file, some rows don't have the column date as below sample&lt;/P&gt;&lt;PRE&gt;{"id":3,"name":"PRGN","Date_End":"2019-04-08T11:52:45.000Z"}
{"id":9,"name":"FXUL10"}&lt;/PRE&gt;&lt;P&gt;Below is the logic I am using in the job&amp;nbsp;&lt;/P&gt;&lt;P&gt;tFileInputDelimited&amp;gt;tExtractJSONFields&amp;gt;tMap&amp;gt;tFileOutputDelimited&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Date_End is a string data type in the data source&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the tMap I used below logic&lt;/P&gt;&lt;P&gt;Then I tried:&lt;/P&gt;&lt;PRE&gt;(row2.Date_End.equals(""))||(row2.Date_End==null) ? null : &lt;BR /&gt;(TalendDate.parseDate("EEE MMM dd HH:mm:ss Z yyyy",row2.Date_End))&lt;/PRE&gt;&lt;P&gt;Output Result:&lt;/P&gt;&lt;P&gt;java.lang.NullPointerException&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 01 May 2019 17:28:09 GMT</pubDate>
    <dc:creator>Karuetl</dc:creator>
    <dc:date>2019-05-01T17:28:09Z</dc:date>
    <item>
      <title>Null Pointer Exception When reading from JSON file</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Null-Pointer-Exception-When-reading-from-JSON-file/m-p/2287641#M61209</link>
      <description>&lt;P&gt;In the JSON file, some rows don't have the column date as below sample&lt;/P&gt;&lt;PRE&gt;{"id":3,"name":"PRGN","Date_End":"2019-04-08T11:52:45.000Z"}
{"id":9,"name":"FXUL10"}&lt;/PRE&gt;&lt;P&gt;Below is the logic I am using in the job&amp;nbsp;&lt;/P&gt;&lt;P&gt;tFileInputDelimited&amp;gt;tExtractJSONFields&amp;gt;tMap&amp;gt;tFileOutputDelimited&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Date_End is a string data type in the data source&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the tMap I used below logic&lt;/P&gt;&lt;P&gt;Then I tried:&lt;/P&gt;&lt;PRE&gt;(row2.Date_End.equals(""))||(row2.Date_End==null) ? null : &lt;BR /&gt;(TalendDate.parseDate("EEE MMM dd HH:mm:ss Z yyyy",row2.Date_End))&lt;/PRE&gt;&lt;P&gt;Output Result:&lt;/P&gt;&lt;P&gt;java.lang.NullPointerException&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 May 2019 17:28:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Null-Pointer-Exception-When-reading-from-JSON-file/m-p/2287641#M61209</guid>
      <dc:creator>Karuetl</dc:creator>
      <dc:date>2019-05-01T17:28:09Z</dc:date>
    </item>
    <item>
      <title>Re: Null Pointer Exception When reading from JSON file</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Null-Pointer-Exception-When-reading-from-JSON-file/m-p/2287642#M61210</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;What does the output look like from tExtractJSONFields? Could you please use tLogRow behind tExtractJSONFields to print out it on console?&lt;/P&gt;
&lt;P&gt;Best regards&lt;/P&gt;
&lt;P&gt;Sabrina&lt;/P&gt;</description>
      <pubDate>Mon, 20 May 2019 08:02:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Null-Pointer-Exception-When-reading-from-JSON-file/m-p/2287642#M61210</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-05-20T08:02:54Z</dc:date>
    </item>
    <item>
      <title>Re: Null Pointer Exception When reading from JSON file</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Null-Pointer-Exception-When-reading-from-JSON-file/m-p/2287643#M61211</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;P&gt;Then I tried:&lt;/P&gt;&lt;PRE&gt;(row2.Date_End.equals(""))||(row2.Date_End==null) ? null : &lt;BR /&gt;(TalendDate.parseDate("EEE MMM dd HH:mm:ss Z yyyy",row2.Date_End))&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Swap the order of the End_Date tests so you check &lt;FONT face="courier new,courier" color="#0000FF"&gt;==null&lt;/FONT&gt; first, then it will skip the &lt;FONT face="courier new,courier" color="#0000FF"&gt;.equals("")&lt;/FONT&gt; if it's null.&lt;/P&gt;&lt;P&gt;Another way to do the same thing is &lt;FONT face="courier new,courier" color="#0000FF"&gt;(row2.Date_End==null ? "" :&amp;nbsp;row2.Date_End).equals("") ? ...&lt;/FONT&gt;&amp;nbsp;which is a bit like a SQL coalesce() function.&lt;/P&gt;</description>
      <pubDate>Tue, 21 May 2019 10:58:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Null-Pointer-Exception-When-reading-from-JSON-file/m-p/2287643#M61211</guid>
      <dc:creator>PhilHibbs</dc:creator>
      <dc:date>2019-05-21T10:58:02Z</dc:date>
    </item>
    <item>
      <title>Re: Null Pointer Exception When reading from JSON file</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Null-Pointer-Exception-When-reading-from-JSON-file/m-p/2287644#M61212</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://community.qlik.com/s/profile/0053p000007LMjvAAG"&gt;@Karuetl&lt;/A&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Could you please try like below?&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;PRE&gt;Relational.ISNULL(row2.Date_End) || row2.Date_End.equals("")? null : 
(TalendDate.parseDate("EEE MMM dd HH:mm:ss Z yyyy",row2.Date_End))&lt;/PRE&gt; 
&lt;P&gt;Warm Regards,&lt;BR /&gt;Nikhil Thampi&lt;/P&gt; 
&lt;P&gt;Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 21 May 2019 21:57:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Null-Pointer-Exception-When-reading-from-JSON-file/m-p/2287644#M61212</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-05-21T21:57:13Z</dc:date>
    </item>
  </channel>
</rss>

