title: Fetching JSON which might contain null values
body: <p>I am trying to fetch data using JSON via google script. For the condition given below full data is Parsed JSON Response. The object &quot;tags&quot; need to be stored in a cell. The tag is empty in this case ( JSON: <code>tags: null</code>) so if statement should be sufficient in this case but I am getting an error Cannot read property 'length' of null (line 4, file &quot;Code&quot;). Any solution around this because there can be many empty cells while getting the data using API</p>
  <pre><code>var f3 = fullData.tags 
        var valar3 = &quot;&quot;;
        if (f3 = null) {currentSheet.getRange(i+2,21).setValue(&quot;&quot;)}
        else {for (var b=0; b&lt;fullData.tags.length; b++){
          var val = fullData.specificExams[b];
          valar3 += val + &quot;,&quot;;}}
        valar3 = valar3.substring(0, valar3.length - 1);
        currentSheet.getRange(i+2,21).setValue(valar3);
  </code></pre>