My supertype is annotated with
@JsonTypeInfo(use = Id.NAME, include = As.PROPERTY, property = "_typeid")
-so that serialised subtypes include the extra field _typeid
containing the name of the subtype. This is intentional and necessary for my app.
But in a particular context I would like to export them as "pure" JSON
, i.e. without the _typeid
metadata field.
Is there any way of making an ObjectMapper
ignore the @JsonTypeinfo
annotation during serialisation? I can't find any relevant config- or feature settings. Would I have to resort to postfiltering or alternative serialisers?
I know that removing or altering the annotations would do it, but this is not an option in this case.
ObjectMapper().configure(MapperFeature.USE_ANNOTATIONS, false);
-will turn off all annotations. This does remove the offending field, but also kills other annotations that I would like to work.