title: Convert a Java List<String> into a Javascript array
body: <p>I'm using the jQuery UI autocomplete to show suggestions for a text input field.
  The suggestions are stored in a Javascript array called suggestions. </p>
  
  <p>I'm trying to fetch the string values for the suggestions array from a database, but I can't convert the List object to a Javascript array.</p>
  
  <p>The Javascript:</p>
  
  <pre><code>var suggestions = [];
  $.get('/mywebapp/autocompleteplayer.html', function(data){
      parsed = JSON.parse(data);
      suggestions = parsed.split(",");
  }, "json");
  
  $('#autocompleted').autocomplete({
      data: suggestions,
      minLength: 3
  });
  </code></pre>
  
  <p>The Spring MVC controller: </p>
  
  <pre><code>@Controller
  public class AutocompletePlayerController {
  
      @RequestMapping(value = "/autocompleteplayer")
      public List&lt;String&gt; getPlayerSuggestions(){
  
          List&lt;String&gt; myList;
          //code that fills myList with all of the players' full names from the database, omitted for brevity
          return myList;
      }
  }
  </code></pre>
  
  <p>I know I'm not parsing the AJAX response properly, since I've checked from the browser console that the suggestions array has 0 elements. Can anyone help me? What am I doing wrong here?</p>