Undefined Title

Undefined Title

Indentation with Jackson in springframework using annotation configuration

ObjectMapper of jackson has a feature to make indent when deserializing as JSON. Here is a way to use it on springframework.

A keen colleague who is special familiar with spring tought me this =)

public class ObjectMapperConfiguration {
    class ConfiguredJacksonJsonProvider
        extends JacksonJsonProvider
        implements MessageBodyWriter<Object>, MessageBodyReader<Object> {
        public ConfiguredJacksonJsonProvider() {
            super(new ObjectMapper().configure(Feature.INDENT_OUTPUT, true));

    public JacksonJsonProvider jacksonJsonProvider() {
        return new ConfiguredJacksonJsonProvider();