title: Simple string as JSON return value in spring rest controller
body: <p>Let's take a look at the following simple test controller (Used with Spring 4.0.3):</p>
  
  <pre class="lang-java prettyprint-override"><code>@RestController
  public class TestController
  {
      @RequestMapping("/getList")
      public List&lt;String&gt; getList()
      {
          final List&lt;String&gt; list = new ArrayList&lt;&gt;();
          list.add("1");
          list.add("2");
          return list;
      }
  
      @RequestMapping("/getString")
      public String getString()
      {
          return "Hello World";
      }
  }
  </code></pre>
  
  <p>In theory both controller methods should return valid JSON. Calling the first controller method indeed does return the following JSON array:</p>
  
  <pre><code>$ curl -i -H "Accept: application/json" http://localhost:8080/getList
  HTTP/1.1 200 OK
  Content-Type: application/json;charset=UTF-8
  
  ["1","2"]
  </code></pre>
  
  <p>But the second controller method returns the string without quotes which is not a valid JSON string:</p>
  
  <pre><code>$ curl -i -H "Accept: application/json" http://localhost:8080/getString
  HTTP/1.1 200 OK
  Content-Type: application/json;charset=UTF-8
  
  Hello World
  </code></pre>
  
  <p>Why is that so? Can it be configured? Is it a bug? Or a feature I don't understand?</p>