1 Reply Latest reply on Nov 11, 2014 10:41 PM by jaikiran

    How to get rid of the null values when marshalling a bean to JSON with JAX-RS?

    shinzey

      I noticed that WildFly's JAX-RS implementation keeps all the null fields. For example, I get

      {"id":999,"title":null}

      instead of

      {"id":999}


      This is quite annoying that my bean classes have lots of properties, and most of the fields are usually null, so the REST client always get lots of useless values. Additionally this behavior introduces much more network overhead.


      Is there any way to get rid of the null fields without introducing a 3rd party library?