Skip to Content
Former Member
Oct 10, 2017 at 06:09 PM

Remove Indentation in JSON Response of all OCC services


Need to remove the extra spaces and whitelines from the response of all OCC services for Hybris 6.2 and above. Found the below code snippets for achieving that using Spring / Jackson. How do we achieve a similar result to remove / minify / optimize the response of all OCC services from hybris?

     public Jackson2ObjectMapperBuilder objectMapperBuilder() {
         Jackson2ObjectMapperBuilder builder = new Jackson2ObjectMapperBuilder();
         return builder;


 public class WhiteSpaceRemovalDeserializer extends JsonDeserializer<String> {
      public String deserialize(JsonParser jp, DeserializationContext ctxt) {
          // This is where you can deserialize your value the way you want.
          // Don't know if the following expression is correct, this is just an idea.
          return jp.getCurrentToken().asText().trim();