Customize JSON Serialization of Domain-Specific POJO Models


Many built-in Jackson Mixin Types (JacksonMixInAnnotations) are included to customize the default JSON serialization behavior for the HST Content Beans.

You can also add your own Jackson Mixin Types (JacksonMixInAnnotations) in order to customize the serialization for your domain-specific POJO models.

Add Custom Jackson Mixin Types

In order to add any custom Jackson Mixin Types (JacksonMixInAnnotations) in your project, add an XML file at one of the following locations (depending on the Delivery API version) in your project:

Delivery API 1.0:


Delivery API 0.9 (Bloomreach Experience Manager 14 only):


Inside the XML file, configure the bean named pageModelJacksonObjectMapperExtraMixins with your custom mixin types like the following example:

  <bean id="pageModelJacksonObjectMapperExtraMixins"
    <property name="sourceMap">
      <map key-type="java.lang.Class" value-type="java.lang.Class">
        <entry key="com.example.beans.OriginalBean" value="com.example.mixins.OriginalBeanMixin" />
        <!-- SNIP -->

The above example adds a pair of the original target class' FQCN (e.g, com.example.beans.OriginalBean) and the new Jackson mixin class' FQCN (com.example.mixins.OriginalBeanMixin). So, whenever serializing an OriginalBean model object, the underlying ObjectMapper will combine the annotations defined in the OriginalBeanMixin class, resulting in custom serializations without changing the original target class.




Did you find this page helpful?
How could this documentation serve you better?
On this page
    Did you find this page helpful?
    How could this documentation serve you better?