title: How to detect an empty element of a JSON response
body: <p>I'm getting a JSON response after an AJAX call. The response contains some elements like id, name, number, etc. The method return sometimes just the id and the number, in other cases the id, the name and the number. In the success part of the AJAX, JQuery method I'm testing if I'm getting the right keys . When a key like name dosen't exists I'm getting an error : <code>Cannot read property 'name' of null</code>. It's clear that's i have a problem in my if condition.</p>
  
  <pre><code>$.ajax({
        url: "edit_info",
        type: 'POST',
        data: {
          'id': id
        },
        success: function(data) {
          if (data.name) {
            console.log(data.name);
        }
  });
  </code></pre>
  
  <p>So any alternative</p>