Code Memory: Jersey Client with Customize JSON (Jackson) Configuration
Jersey Client with Customize JSON (Jackson) Configuration
ClientConfig clientConfig = new DefaultClientConfig(); // Allow Jersey Client support JSON. clientConfig.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE); // Create your own Jackson ObjectMapper. ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); // Create your own JacksonJaxbJsonProvider and then assign it to the config. JacksonJaxbJsonProvider jacksonProvider = new JacksonJaxbJsonProvider(); jacksonProvider.setMapper(mapper); clientConfig.getSingletons().add(jacksonProvider); Client client = Client.create(clientConfig);
Read full article from Code Memory: Jersey Client with Customize JSON (Jackson) Configuration
No comments:
Post a Comment