title: How to print List() in @RestController Response?
body: <p>I've a controller in a Spring App with this Code:</p>
  
  <pre><code>@RequestMapping("/")
  @ResponseBody
  public ResponseObject index(){
      System.out.println(this.sf);
      Session session = sf.openSession();
      List&lt;Project&gt; projects = session.createQuery("from Project").list();
      session.close();
      System.out.println(projects);
      return new ResponseObject(projects);
  }
  </code></pre>
  
  <p>I've tried to return <code>List&lt;Project&gt;</code> and also my new created Object <code>ResponseObject</code> with this code:</p>
  
  <pre><code>public class ResponseObject {
      protected Object data;
      protected Object error;
  
      public ResponseObject(Object data) {
          this.data = data;
      }
  
      public Object getData() {
          return data;
      }
  
      public void setData(Object data) {
          this.data = data;
      }
  
      public Object getError() {
          return error;
      }
  
      public void setError(Object error) {
          this.error = error;
      }
  }
  </code></pre>
  
  <p>But in all cases my JSON Reponse looks like: <code>{"data":[{}],"error":null}</code>.</p>
  
  <p><code>Projects</code> output is : <code>[Project{id=1, name='Digital project'}]</code></p>
  
  <p>Can anybody tell me why my List is not included in the JSON? Thanks!</p>