2 Replies Latest reply on Jun 3, 2016 4:36 AM by sonyjop

    How to avoid "null" in replies from RESTEasy service on AS 7.1

    stsc

      I need to supress attributes with null in the reply fron JSON rest-services.

       

      In the eclipse example "jboss-javaee6-webapp", I have treid to add a attribute "text" to the Member class, and watched the output:

       

      {"id":1,"name":"dfdfdfdf","email":"dfdfdf@ddsds","phoneNumber":"11111111111","text":null} - well, this is expected for a start.

       

      As far as I can read the documentation, adding @JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) to the class should change this. But it doesn't the output remains the same. Still a null value displayed

       

      What's missing?

       

      A similar project can be fetch from http://www.jboss.org/jdf/quickstarts/jboss-as-quickstart/kitchensink-ear/

       

      I've added this depenedencey to ejb-part pom.xml of the project (ejb module) to have access to the annotation.

              <dependency>

                  <groupId>org.jboss.resteasy</groupId>

                  <artifactId>resteasy-jackson-provider</artifactId>

                  <version>2.3.2.Final</version>

                  <scope>provided</scope>

              </dependency>