title: Spring MVC -> JSON response
body: <p>I hava a JAVA EE backend and I am using Spring MVC. I have a AJAX call like this:</p>
  
  <pre><code>function getAllProjects() {
          $.getJSON("project/getall", function(allProjects) {
              ???
          });
      }
  </code></pre>
  
  <p>My backend system:</p>
  
  <pre><code>@RequestMapping(value="/getall", method=RequestMethod.GET)
  public @ResponseBody ??? getAllProjects() {
      ???
  }
  </code></pre>
  
  <p>What is the content I have to implement so it will work? In the backend system I have from a database call the unique id and the name of the project, for example:</p>
  
  <pre><code>1 =&gt; My Test Project
  4 =&gt; Another One
  23 =&gt; One More Test
  </code></pre>
  
  <p>The id and the project name should be returned to the frontend system, so I can build a HTML ul/li list in this kind:</p>
  
  <pre><code>&lt;ul&gt;
      &lt;li&gt;&lt;a href="/1"&gt;My Test Project&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href="/4"&gt;Another One&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href="/23"&gt;One More Test&lt;/a&gt;&lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>Does anyone know how this can be done?</p>