title: JSON object group by value
body: <p>I created product database with JSON:</p>
  
  <pre><code>{
  "1": {"group":"1", "name":"bmw" },
  "2": {"group":"1", "name":"audi"},
  "3": {"group":"2", "name":"volvo"}
  }
  </code></pre>
  
  <p>But now I need to create an HTML drop down with all elements by group id.</p>
  
  <p>I tried using Javascript <code>.grep()</code> but I don't have enough experience how to do that. Any help?</p>
  
  <pre><code>var all;
  $.getJSON("data.json", function( data ) {
      all = data;
  });
  var group1 = $.grep(all, function(el, i) {
      return el.group. === 2
  });
  console.log(JSON.stringify(group1));
  </code></pre>