cancel
Showing results for 
Search instead for 
Did you mean: 

JsonIgnoreProperties Annotation doesn't work for OOTB attributes in WsDTOs

superpalmi
Explorer
0 Kudos

Hi, I'm trying to exclude some WsDTO fields to the request output, such as firstName from UserWsDTO.

I'm using @JsonIgnoreProperties to exclude that but It doesn't seem to work:

<bean class="de.hybris.platform.commercewebservicescommons.dto.user.UserWsDTO">
    <import type="com.fasterxml.jackson.annotation.JsonIgnore" />
    <import type="com.fasterxml.jackson.annotation.JsonIgnoreProperties" />
    <annotations>
        @JsonIgnoreProperties({"firstName})
    </annotations>
    <property name="fidelityCard" type="java.lang.String"/>
</bean>

I couldn't use @JsonIgnore directly on the field because It's and unmodifiable field from Hybris, and I was looking if there was a way to "override" some fields so that I could use JsonIgnore like this:
<bean>

    <import type="com.fasterxml.jackson.annotation.JsonIgnore" />
    <import type="com.fasterxml.jackson.annotation.JsonIgnoreProperties" />
    <property name="fidelityCard" type="java.lang.String"/>
    <property name="firstName" type="java.lang.String">
      <annotations>
          @JsonIgnore()
      </annotations>
    </property>
</bean>

Accepted Solutions (0)

Answers (0)