title: Jackson PrettyPrint for Spring 4
body: <p>The goal is to make Jackson format response from controllers with PrettyPrint.
  Thats my configuration for it:</p>
  
  <pre><code>@EnableWebMvc
  @Configuration
  public class JacksonConfig extends WebMvcConfigurerAdapter {
      @Override
      public void extendMessageConverters(List&lt;HttpMessageConverter&lt;?&gt;&gt; converters) {
          for (HttpMessageConverter&lt;?&gt; converter : converters) {
              if (converter instanceof MappingJackson2HttpMessageConverter) {
                  MappingJackson2HttpMessageConverter jsonMessageConverter = (MappingJackson2HttpMessageConverter) converter;
                  ObjectMapper objectMapper = jsonMessageConverter.getObjectMapper();
                  objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
                  objectMapper.enable(SerializationFeature.INDENT_OUTPUT);
              }
          }
      }
  } 
  </code></pre>
  
  <p>Thats how a controller looks like:</p>
  
  <pre><code>@RequestMapping(value = "/facebook", method = RequestMethod.POST, produces = "application/json")
  public @ResponseBody Map&lt;String, Object&gt; authorizeViaFacebook(
          @RequestParam(value = "token") String token) throws DefaultException{
  
      Facebook facebook = this.facebookUtility.getFacebook(token);
      org.springframework.social.facebook.api.User facebookUserProfile = facebook.userOperations().getUserProfile("me");
  
      User loggedInUser = User.signInWithFacebookProfile(facebookUserProfile);
  
      return ImmutableMap.of("token", loggedInUser.tokenForAuthentication(), "user", loggedInUser);
  }
  </code></pre>
  
  <p>But no matter what I do it still prints it straight. I tried different configurations but still no success. </p>
  
  <p>Here is a POM file for Jackson:</p>
  
  <pre><code>    &lt;dependency&gt;
          &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;
          &lt;artifactId&gt;jackson-annotations&lt;/artifactId&gt;
          &lt;version&gt;2.6.0&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;
          &lt;artifactId&gt;jackson-databind&lt;/artifactId&gt;
          &lt;version&gt;2.6.0&lt;/version&gt;
      &lt;/dependency&gt;
  </code></pre>
  
  <p>Spring version is 4.2.4.RELEASE.</p>
  
  <p>How do I make Jackson use PrettyPrint format?  </p>