title: Best way to navigate throught a JSON in Node while validating the path
body: <p>I'm trying to get some info out of a API call in Nodejs, structured something like a JSON:</p>
  
  <pre><code>  { 
     "generated":"2019-11-04T09:34:11+00:00",
     "event":{ 
        "id":"19040956",
        "start_":"2019-11-16T11:30:00+00:00",
        "event_context":{ 
           "sport":{ 
              "id":"1",
              "name":"Soccer"
           }
        }
     }
  }
  </code></pre>
  
  <p>I'm not sure about the presence of none of these fields(Json could be incomplete).
  Is there a better way to get the value of "name" in <em>JSON.event.event_context.sport.name</em> <strong>without an ugly if</strong> to not get errors like "cannot get field 'sport' of undefined"?
  Currently, I'm doing </p>
  
  <pre><code>if(json.event &amp;&amp; json.event.event_context &amp;&amp; json.event.event_context.sport) {
   return json.event.event_context.sport.name;
  }
  </code></pre>
  
  <p><strong>Is there a better way?</strong>
  Thank you!</p>