title: In Select2, how do formatSelection and formatResult work?
body: <p>I'm using Select2 (<a href="http://ivaynberg.github.io/select2/" rel="nofollow">http://ivaynberg.github.io/select2/</a>) to have an input field of a form (let's say its id is <code>topics</code>) to be in tagging mode, with the list of existing tags (allowing the user to choose some of these tags, or to create new ones) being provided by an array of remote data. </p>
  
  <p>The array (<code>list.json</code>) is correctly got from my server. It has <code>id</code> and <code>text</code> fields, since Select2 seems to need these fields. It thus looks like this:</p>
  
  <pre><code>[ { id: 'tag1', text: 'tag1' }, { id: 'tag2', text: 'tag2' }, { id: 'tag3', text: 'tag3' } ]
  </code></pre>
  
  <p>The script in the HTML file looks like this:</p>
  
  <pre><code>$("#topics").select2({
      ajax: { 
          url: "/mypath/list.json",
          dataType: 'json',
          results: function (data, page) { 
          return {results: data};
          },   
      }
  });
  </code></pre>
  
  <p>But the input field is showing "searching", which means it's not able to use the array for tagging support.</p>
  
  <p>In the script with Select2, I know I have to define <code>formatSelection</code> and <code>formatInput</code>, but I'm not getting how they should work in my case, although I have read the Select2 documentation... Thank you for your help!</p>