title: Create new array object from existing object
body: <p>I have a json file that's returned from a service am using. I have no control over the service therefore can't change the structure of the json file. The file looks something like:</p>
  
  <pre><code>menu":[    
   {
    "section":"theMobileMenu",
    "key":"menuItem1Title",
    "content":"Mobile context and principles"
  },
  {
    "section":"theMobileMenu",
    "key":"menuItem1Link",
    "content":"/mobile/index.html"
  },
  {
    "section":"theMobileMenu",
    "key":"menuItem2Title",
    "content":"Global guidelines"
  },
  {
    "section":"theMobileMenu",
    "key":"menuItem2Link",
    "content":"/mobile/global-guidelines.html"
  },
  {
    "section":"theMobileMenu",
    "key":"menuItem3Title",
    "content":"First impressions"
  },
  {
    "section":"theMobileMenu",
    "key":"menuItem3Link",
    "content":"/mobile/first-impressions.html"
  }
  ]
  </code></pre>
  
  <p>I want to create an array of objects like the one below</p>
  
  <pre><code>    "menu":[
   {
   "title":"Mobile context and principles",
   "link":"/mobile/index.html"
   },
  {
  "title":"Global guidelines",
   "link":"/mobile/global-guidelines.html"
  },
  {
  "title":"First impressions",
   "link":"/mobile/first-impressions.html"
  }
  ]
  </code></pre>
  
  <p>I've tried something like:</p>
  
  <pre><code>var newData = []
  var curData = {};
  var x = 1;
  
  $.each(data.menu, function(i, val) {            
      if(val.key == 'menuItem'+x+'Link'){
          curData.link = val.content;         
      }
      if(val.key == 'menuItem'+x+'Title'){
          curData.title = val.content;            
      }
      newData.push(curData)
      curData = []
      x++;            
  })  
  </code></pre>
  
  <p>This doesn't work very well. Any ideas on how to work this out?</p>