title: How to set optgroup in select2 using JSON
body: <p>How some items can be group in separate <code>optgroups</code>? Should be set in different <code>JSON</code> objects? There is no example in <code>select2</code> documentation. Any help or direction would be helpful.</p>
  
  <p>Here is example code of <code>select</code> population:</p>
  
  <p><code>jQuery</code> code:</p>
  
  <pre><code> var data = [
            { id: 0, text: 'enhancement' }, 
            { id: 1, text: 'bug' }, 
            { id: 2, text: 'duplicate' }, 
            { id: 3, text: 'invalid' }, 
            { id: 4, text: 'wontfix' }
      ];
  
      $(".js-example-data-array").select2({
        data: data
      });
  </code></pre>