title: With RESTful API, how I don't make error in the client side if specific response json level is undefined
body: <p>here is a simple response json:</p>
  
  <pre class="lang-js prettyprint-override"><code>{
    "blog": {
      "title": "Blog"
      "paragraphs": [{
          "title": "paragraph1",
          "content": "content1"
        }, {
          "title": "paragraph2",
          "content": "content2"
        }, {
          "title": "paragraph3",
          "content": "content3"
        }
  
      ],
      "selectList": ["food", "play", "mood"]
    }
  }
  </code></pre>
  
  <p>If something wrong with server, <code>paragraphs</code> property is <code>undefined</code>, how I avoid to make error in the client side? Even I still could get other datas successfully, like <code>blog.title</code>, <code>blog.selectList</code>...etc</p>
  
  <p>if I don't want to use :</p>
  
  <pre class="lang-js prettyprint-override"><code>if (response.blog &amp;&amp; response.blog.paragraphs &amp;&amp; response.blog.paragraphs....) {
    //do something
  }
  </code></pre>
  
  <p>Because if there are many level in JSON object, it is not efficient way. Is anyone have smart and efficient way?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>@MatthewHerbst said:just check the lowest property.</p>
  
  <p>if I just check the lowest property(<code>response.blog.paragraphs</code>), that will make javascript error, crush my site. because the browser found <code>response.blog</code> is undefined. In the real case, if <code>response.blog</code> is <code>undefined</code>, I will get <code>response.error</code> property, then <code>if(response.blog.paragraphs)</code> will encounter error, because <code>response</code> object doesn't defined <code>blog</code> property in javascript. how I just check the lowest property?</p>