How can I ignore unrecognized properties using

I have built a web client which uses SSL.

The client is initialized like this:

SSLContext sc = SSLContext.getInstance("ssl");
        sc.init(null, noopTrustManager, null);
        this.client = ClientBuilder.newBuilder().

Then the web target is initialized like this:

this.webTarget =;

And the Invocation Builder is initialized like this:

Builder request = this.webTarget.request();

But when – after setting the headers appropriately – I try to do this:


I get the following error message: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field “timestamp” (class com.interaxa.ivr.visual.moa.service.model.InitiateTransferResponse), not marked as ignorable

Is there a way to tell the builder to ignore all unrecognized properties? (I intend to use this same builder for other web services too, and it would be nice if I could set it to ignore unknown properties permanently, regardless of the response class).

Thank you in advance.


I have found a solution!

The key is to replace the line: request.get(InitiateTransferResponse.class);

By this code:

        InitiateTransferResponse result;
        try {
            result = getMapper().readValue(response, InitiateTransferResponse.class);
        catch (IOException e) {
            result = null;

Where getMapper() is as follows:

public ObjectMapper getMapper() {
        if (mapper == null){
            mapper = new ObjectMapper();
            mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
            mapper.configure(DeserializationConfig.Feature.FAIL_ON_NULL_FOR_PRIMITIVES, false);
        return mapper;

And ObjectMapper is

This way, the ObjectMapper controls what it lets through rather than leaving that decision to the Builder.

Leave a Reply

Your email address will not be published. Required fields are marked *