title: Dynamic root element with Jackson
body: <p>I'm currently working on a project that deals with elements that (for legacy reasons) must have a tag name that represents their type.</p>
  <p>Basically I have this:</p>
  <pre class="lang-java prettyprint-override"><code>@JsonRootName(&quot;node&quot;)
  class NodeDocument {
      private String type;
  }
  </code></pre>
  <p>Which outputs something like:</p>
  <pre class="lang-xml prettyprint-override"><code>&lt;node type=&quot;someType&quot;&gt;&lt;/node&gt;
  </code></pre>
  <p>But what's expected would be:</p>
  <pre class="lang-xml prettyprint-override"><code>&lt;someType&gt;&lt;/someType&gt;
  </code></pre>
  <p><code>@JsonRootName</code> doesn't seem to be usable on a method or attribute.</p>
  <p>Even though there is <code>SerializationConfig.withRooName()</code> or custom serializers, I can't seem to find a way to define the root name with a dynamic value stored in the object itself.</p>