When using Spring MVC for REST, how do you enable Jackson to pretty-print rendered JSON? -


while developing rest services using spring mvc, render json 'pretty printed' in development normal (reduced whitespace) in production.

if using spring boot 1.2 or later simple solution add

spring.jackson.serialization.indent_output=true 

to application.properties file. assumes using jackson serialization.

if using earlier version of spring boot can add

http.mappers.json-pretty-print=true 

this solution still works spring boot 1.2 deprecated , removed entirely. deprecation warning in log @ startup time.

(tested using spring-boot-starter-web)


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -