title: How to get json value by string?
body: <p>I receive the following string from the server response：</p>
  
  <pre><code>var jsonData = '[{"firstName":"Bill","lastName":"Gates"},{"firstName":"George","lastName":"Bush"},{"firstName":"Thomas","lastName":"Carter"}]';
  </code></pre>
  
  <p>I see some jquery plugins can predefine the keys they want</p>
  
  <p>like: index:"firstName", and they get a ul like</p>
  
  <pre><code>&lt;li&gt;Bill&lt;/li&gt;
  &lt;li&gt;George&lt;/li&gt;
  &lt;li&gt;Thomas&lt;/li&gt;
  </code></pre>
  
  <p>If index:"lastName", they get a ul like</p>
  
  <pre><code>&lt;li&gt;Gates&lt;/li&gt;
  &lt;li&gt;Bush&lt;/li&gt;
  &lt;li&gt;Carter&lt;/li&gt;
  </code></pre>
  
  <p>The only way I know how to parse a json format string is:</p>
  
  <pre><code>var object = JSON.parse(jsonData);
  var firstName = object[i].firstName;
  var lastName= object[i].lastName;
  </code></pre>
  
  <p>The plugin pass the index like a parameter</p>
  
  <pre><code>function f(index) {
      return object[i].index;
  }
  </code></pre>
  
  <p>How can they achieve this？</p>
  
  <p>Thanks for helping!</p>