title: Efficiently rename/re-map javascript/json object keys within array of objects
body: <p>I have some structured JSON data like so. Let's assume this is interchangeable, via <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse" rel="noreferrer"><code>JSON.parse()</code></a>:</p>
  
  <pre><code>[
      {
          "title": "pineapple",
          "uid": "ab982d34c98f"
      },
      {
          "title": "carrots",
          "uid": "6f12e6ba45ec"
      }
  ]
  </code></pre>
  
  <p>I need it to look like this, remapping <code>title</code> to <code>name</code>, and <code>uid</code> to <code>id</code> with the result:</p>
  
  <pre><code>[
      {
          "name": "pineapple",
          "id": "ab982d34c98f"
      },
      {
          "name": "carrots",
          "id": "6f12e6ba45ec"
      }
  ]
  </code></pre>
  
  <p>The most obvious way of doing it is like this:</p>
  
  <pre><code>str = '[{"title": "pineapple","uid": "ab982d34c98f"},{"title": "carrots", "uid": "6f12e6ba45ec"}]';
  
  var arr = JSON.parse(str);
  for (var i = 0; i&lt;arr.length; i++) {
      arr[i].name = arr[i].title;
      arr[i].id = arr[i].uid;
      delete arr[i].title;
      delete arr[i].uid;
  }
  </code></pre>
  
  <p><div class="snippet" data-lang="js" data-hide="true" data-console="true" data-babel="false">
  <div class="snippet-code snippet-currently-hidden">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>str = '[{"title": "pineapple","uid": "ab982d34c98f"},{"title": "carrots",      "uid": "6f12e6ba45ec"}]';
  
  var arr = JSON.parse(str);
  for (var i = 0; i&lt;arr.length; i++) {
      arr[i].name = arr[i].title;
      arr[i].id = arr[i].uid;
      delete arr[i].title;
      delete arr[i].uid;
  }
  
  $('body').append("&lt;pre&gt;"+JSON.stringify(arr, undefined, 4)+"&lt;/pre&gt;");</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>...or using something more complex (albeit <em>not</em> more efficient) like <a href="https://stackoverflow.com/questions/4647817/javascript-object-rename-key">this</a>.</p>
  
  <p>This is all fine and dandy, but what if there were 200,000 objects in the array? This is a lot of processing overhead. </p>
  
  <p><strong>Is there a more efficient way to remap a key name? Possibly without looping through the entire array of objects? If your method is more efficient, please provide proof/references.</strong> </p>