title: How can i prepare nested key value pair list in JavaScript
body: <p>I have data in rows like </p>
  
  <pre><code>1. {type:"pant", service:"normal", price:"30"}
  2. {type:"pant", service:"premium 1", price:"50"}
  3. {type:"pant", service:"premium 2", price:"70"}
  4. {type:"pant", service:"premium 3", price:"100"}
  </code></pre>
  
  <p>Looking for something like </p>
  
  <pre><code>var x = {"pant", [{service:"normal", price:"30"},{service:"premium 1", price:"50"} ,{service:"premium 2", price:"70"}, {service:"premium 3", price:"100"}]}
  </code></pre>
  
  <p>so that I can get all type of services and their price by doing <strong>x['pant']</strong></p>