title: Pivot or Transforming JavaScript object
body: <p>I have the following JavaScript object. I need to generate a new object from the given object. What is the approach I should take in JavaScript?</p>
  
  <pre><code>[
   {"name": "Dan",  "city" : "Columbus", "ZIP":"47201"},
   {"name": "Jen",  "city" : "Columbus", "ZIP":"47201"},
   {"name": "Mark", "city" : "Tampa",  "ZIP":"33602"},
  ]
  </code></pre>
  
  <p>How can I transform or pivot to generate the following object?</p>
  
  <pre><code>[
   { "47201": [
                {"name": "Dan", "city": "Columbus"},
                {"name": "Jen", "city": "Columbus"},
               ],
      "count": "2"
    },
    { "33602": [
                {"name": "Mark", "city": "Tampa"}
               ],
      "count": "1"
    }
   ]
  </code></pre>