You would need to configure this by instantiating and configuring the JacksonJsonProvider
for the Jersey Client
.
Jersey V2.x:
JacksonJsonProvider jacksonJsonProvider =
new JacksonJaxbJsonProvider()
.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
client.register(jacksonJsonProvider);
Jersey V1.x:
DefaultClientConfig clientConfig = new DefaultClientConfig();
JacksonJsonProvider jacksonJsonProvider = new JacksonJaxbJsonProvider().
configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
clientConfig.getSingletons().add(jacksonJsonProvider);
Worth noting is that the underlying issue is that your JSON contains the field "empty" ... I'm assuming it's getting there because you're serializing that same POJO. Wouldn't annotating that isEmpty()
method to be ignored for serialization if you actually don't want it in the JSON be better?