tags:

views:

407

answers:

2

Is it possible to use Jackson as the serializer/marshaller for JSON data instead of JAXB when using Jersey Client API?

If so how to configure it?

+3  A: 

OK, I found it out, it turns out to be quite simple after all:

ClientConfig cc = new DefaultClientConfig();
cc.getClasses().add(JacksonJsonProvider.class);
Client clientWithJacksonSerializer = Client.create(cc);

The JacksonJsonProvider comes from the jackson-jaxrs package.

Maciej Biłas
Cool, this is good to know.
StaxMan
A: 

Where should I put that code?

Jonny
Uhm, that's how you construct the jersey client when you want to register the JacksonJsonProvider.
Maciej Biłas