Dynamic root element with Jackson
问题 I'm currently working on a project that deals with elements that (for legacy reasons) must have a tag name that represents their type. Basically I have this: @JsonRootName("node") class NodeDocument { private String type; } Which outputs something like: <node type="someType"></node> But what's expected would be: <someType></someType> @JsonRootName doesn't seem to be usable on a method or attribute. Even though there is SerializationConfig.withRooName() or custom serializers, I can't seem to