title: How to serialize with and without root element with Jackson
body: <p>I am using Jackson 1.9.x to serialize/deserialize object to/from JSON.</p>
  
  <p>The requirement is that some objects must be serialized with root element and some must not. I know that I can switch this feature on/off with the code:</p>
  
  <pre><code>mapper.configure(org.codehaus.jackson.map.SerializationConfig.Feature.WRAP_ROOT_VALUE, true);
  </code></pre>
  
  <p>However I cannot set this globally since it needs to be changed at runtime.</p>
  
  <p>I tried to use custom serializer but then when my custom 'serialize' method gets called I cannot disable root elements because the root element is already generated.</p>
  
  <p>Any suggestions are welcome.</p>