title: Jackson JSON List with Object Type
body: <p>I have to serialize JSON from a list of Objects. The resulting JSON has to look like this:</p>
  
  <pre><code>{
      "status": "success",
      "models": [
          {
              "model": {
                  "id": 23,
                  "color": "red"
              }
          },
          {
              "model": {
                  "id": 24,
                  "color": "green"
              }
          }
      ]
  }
  </code></pre>
  
  <p>I am missing the type/key "model" when I simply serialize this:</p>
  
  <pre><code>List&lt;Model&gt; list = new ArrayList&lt;Model&gt;(); // add some new Model(...)
  Response r = new Response("success", list); // Response has field "models"
  </code></pre>
  
  <p>Instead I just get this:</p>
  
  <pre><code>{
      "status": "success",
      "models": [
          {
              "id": 23,
              "color": "red"
          },
          {
              "id": 24,
              "color": "green"
          }
      ]
  }
  </code></pre>
  
  <p>How can I add "model" for each object without having to write a silly wrapper class with a property "model"?</p>
  
  <p>My classes look like this:</p>
  
  <pre><code>public class Response {
      private String status;
      private List&lt;Model&gt; models;
      // getters / setters
  }
  
  public class Model {
      private Integer id;
      private String color;
      // getters / setters
  }
  </code></pre>