вторник, 5 августа 2014 г.

Pretty print JSON with Spring REST Service

To enable pretty print functionality with your Spring MVC Controller you can use the following configuration:
<mvc:annotation-driven>
        <mvc:message-converters>
            <bean id="jacksonHttpMessageConverter" class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
                <property name="prettyPrint" value="true" />
            </bean>
        </mvc:message-converters>
    </mvc:annotation-driven>

After this you JSON from Spring REST Service will be nicely indented.