Class JsonFeature

  • All Implemented Interfaces:
    javax.ws.rs.core.Feature

    public class JsonFeature
    extends Object
    implements javax.ws.rs.core.Feature

    Feature to map responses and requests JSON formatted entities to Java objects.

    The jackson library (JacksonJsonProvider) is used to implement this feature.

    Customization

    The serialization and deserialization is customizable by using feature properties. Any Jackson DeserializationFeature or SerializationFeature can be adressed with a property prefixed with the 'Serializer' respectively the 'Deserializer'.

    Extract of available serializer properties:

    PropertyDefaultDescription
    JSON.Deserialization.FAIL_ON_UNKNOWN_PROPERTIEStrueDetermines whether encountering of unknown properties (ones that do not map to a property, and there is no "any setter" or handler that can handle it) should result in a failure (by throwing a JsonMappingException) or not.
    JSON.Serialization.WRITE_DURATIONS_AS_TIMESTAMPStrueDetermines whether time values that represents time periods (durations, periods, ranges) are to be serialized by default using a numeric (true) or textual (false) representations. Note that numeric representation may mean either simple number, or an array of numbers, depending on type.
    Since:
    6.2
    API:
    This is a public API.