title: SerializationFeature.WRAP_ROOT_VALUE as annotation in jackson json
body: <p><strong>Is there a way to have the configuration of <code>SerializationFeature.WRAP_ROOT_VALUE</code> as an annotation on the root element instead using <code>ObjectMapper</code>?</strong></p>
  
  <p>For example I have:</p>
  
  <pre><code>@JsonRootName(value = "user")
  public class UserWithRoot {
      public int id;
      public String name;
  }
  </code></pre>
  
  <p>Using ObjectMapper:</p>
  
  <pre><code>@Test
  public void whenSerializingUsingJsonRootName_thenCorrect()
    throws JsonProcessingException {
      UserWithRoot user = new User(1, "John");
  
      ObjectMapper mapper = new ObjectMapper();
      mapper.enable(SerializationFeature.WRAP_ROOT_VALUE);
      String result = mapper.writeValueAsString(user);
  
      assertThat(result, containsString("John"));
      assertThat(result, containsString("user"));
  }
  </code></pre>
  
  <p>Result:</p>
  
  <pre><code>{
      "user":{
          "id":1,
          "name":"John"
      }
  }
  </code></pre>
  
  <p><strong>Is there a way to have this <code>SerializationFeature</code> as an annotation and not as an configuration on the <code>objectMapper</code>?</strong></p>
  
  <p>Using dependency:</p>
  
  <pre><code>&lt;dependency&gt;
       &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;
       &lt;artifactId&gt;jackson-databind&lt;/artifactId&gt;
       &lt;version&gt;2.7.2&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>