向Spring boot配置文件application.properties中添加如下內(nèi)容即可。 spring.jackson.serialization.indent_output=true