title: Get json value by using a string
body: <p>Let's say that I got the following json object:</p>
  
  <pre><code>var jsonResult = {
      "result": [
           { "UserName": "joga", "FirstName": "Jonas", "LastName": "G" }
           { "UserName": "sss", "FirstName": "Abra", "LastName": "p" }
      ]
  };
  </code></pre>
  
  <p>I got an array with:</p>
  
  <pre><code>var cols = ["UserName", "LastName"];
  </code></pre>
  
  <p>how do I go through the json object and build a string only using the specified columns.</p>
  
  <p>guessing game:</p>
  
  <pre><code>var rows = '&lt;tr&gt;';
  $.each(jsonResult.result, function(jsonKey, jsonValue) { 
     $.each(cols, function(i,columnName) {
       rows += '&lt;td&gt;' + jsonValue.attr(columnName) + '&lt;/td&gt;';       
     });
  });
  </code></pre>
  
  <p>Can anyone show me working code? ;)</p>