title: Force Jackson to add addional wrapping using annotations
body: <p>I have the following class:</p>
  
  <pre><code>public class Message {
      private String text;
  
      public String getText() {
          return text;
      }
  
      public void setText(String text) {
          this.text = text;
      }    
  }
  </code></pre>
  
  <p>When converting the instance to JSON using Jackson by default I get:</p>
  
  <pre><code>{"text":"Text"}
  </code></pre>
  
  <p>I would like to get:</p>
  
  <pre><code>{"message":{"text":"Text"}}
  </code></pre>
  
  <p><strong>Is there any JAXB / Jackson annotation I can use to achieve my goal?</strong></p>
  
  <p>As a workaround, I can wrap my class with another class:</p>
  
  <pre><code>public class MessageWrapper {
      private Message message;
  
      public Message getMessage() {
          return message;
      }
  
      public void setMessage(Message message) {
          this.message = message;
      }
  }
  </code></pre>
  
  <p>or a more generic solution:</p>
  
  <pre><code>public class JsonObjectWrapper&lt;T&gt; {
      /**
       * Using a real map to allow wrapping multiple objects
       */
      private Map&lt;String, T&gt; wrappedObjects = new HashMap&lt;String, T&gt;();
  
      public JsonObjectWrapper() {
      }
  
      public JsonObjectWrapper(String name, T wrappedObject) {
          this.wrappedObjects.put(name, wrappedObject);
      }
  
      @JsonAnyGetter
      public Map&lt;String, T&gt; any() {
          return wrappedObjects;
      }
  
      @JsonAnySetter
      public void set(String name, T value) {
          wrappedObjects.put(name, value);
      }
  }
  </code></pre>
  
  <p>Which can be used like so:</p>
  
  <pre><code>Message message = new Message();
  message.setText("Text");
  JsonObjectWrapper&lt;Message&gt; wrapper = new JsonObjectWrapper&lt;Message&gt;("message", message);
  </code></pre>
  
  <p><strong>Is there any JAXB / Jackson annotation I can use to achieve my goal?</strong></p>
  
  <p>Thanks.</p>