title: Spring configure @ResponseBody JSON format
body: <p>Imagine I have this annotated method in a Spring 3 @Controller</p>
  
  <pre><code>@RequestMapping("")
  public @ResponseBody MyObject index(@RequestBody OtherObject obj) {
      MyObject result = ...;
      return result;
  }
  </code></pre>
  
  <p>But I need to configure the output json format, just as if I were doing:</p>
  
  <pre><code>ObjectMapper om = new ObjectMapper();
  om.configure(JsonGenerator.Feature.QUOTE_FIELD_NAMES, true);
  om.getSerializationConfig()
          .setSerializationInclusion(JsonSerialize.Inclusion.NON_DEFAULT);
  om.getSerializationConfig()
          .set(SerializationConfig.Feature.INDENT_OUTPUT, false);
  </code></pre>
  
  <p>Is there any way to configure this behaviour?</p>
  
  <p>I've found a couple of related questions, but I am not sure about how to adapt them to my specific case:</p>
  
  <ol>
  <li><a href="https://stackoverflow.com/questions/4440607/spring-prefixjson-with-responsebody">spring prefixjson with responsebody</a></li>
  <li><a href="https://stackoverflow.com/questions/3616359/who-sets-response-content-type-in-spring-mvc-responsebody">Who sets response content-type in Spring MVC (@ResponseBody)</a></li>
  </ol>
  
  <p>Thank you !</p>