title: Get key/values from JSON array of objects without knowing the key name
body: <p>I'm trying to build a HTML table with data from a JSON structured array such as:</p>
  
  <pre><code>var myjson = [
  {"firstName":"John", "lastName":"Doe"},
  {"firstName":"Anna", "lastName":"Smith"},
  {"firstName":"Peter","lastName": "Jones"}
  ]; 
  </code></pre>
  
  <p>I know I can use:</p>
  
  <pre><code>var tbl = "&lt;table&gt;"
  
              $.each(myjson, function(x, y) {
                  tbl += "&lt;tr&gt;";
                    tbl += "&lt;td&gt;firstName&lt;/td&gt;";
                    tbl += "&lt;td&gt;lastName&lt;/td&gt;";  
                  tbl += "&lt;/tr&gt;"; 
                  tbl += "&lt;tr&gt;";
                    tbl += "&lt;td&gt;" + y.firstName + "&lt;/td&gt;";
                    tbl += "&lt;td&gt;" + y.lastName + "&lt;/td&gt;";  
                  tbl += "&lt;/tr&gt;"; 
                });
  
  tbl += "&lt;/table&gt;";
  </code></pre>
  
  <p>but how can I get the same result if I don't know what the column names (firstName, lastName) are called? How can I iterate through the key/values of each object in the JSON structured array?</p>
  
  <p>In each array, the number of elements in each object will be the same</p>