title: Sort Json Array with LoDash
body: <p>I have a JSON array whose general structure is like this:</p>
  
  <pre><code>var json = [ 
    { key: 'firstName', value: 'Bill' },
    { key: 'lastName',  value: 'Mans' },
    { key: 'phone', value: '123.456.7890' }
  ];
  </code></pre>
  
  <p>In reality, there will be a lot more key/value pairs. Either way, I'm trying to sort this array by the key value using <a href="http://lodash.com/" rel="noreferrer">Lodash</a>. Currently, I'm trying the following:</p>
  
  <pre><code>_.map(_.sortBy(json, key), _.values);
  </code></pre>
  
  <p>However, that causes an error that says:</p>
  
  <pre><code>[ReferenceError: key is not defined]
  </code></pre>
  
  <p>I suspect its because key is not wrapped in quotes as shown in the <a href="http://lodash.com/docs#sortBy" rel="noreferrer">docs</a>. Unfortunately, I do not actually have control over the format of the json. In reality its being used by other developers and I'm the last to use it. Is there a way for me to sort the json array, by key names, using lodash? If so, how?</p>
  
  <p>thank you</p>