简体   繁体   English

Swagger UI:Pretiftify JSON

[英]Swagger UI: Prettify JSON

Is there a way to make Swagger prettify the JSON on its own, without requiring the called library to output pretty JSON? 有没有办法让Swagger自己对JSON进行美化,而不需要被调用的库输出漂亮的JSON? I can't seem to find anything on the subject. 我似乎无法找到关于这个问题的任何内容。

The answer to your question is on the projects's GitHub . 您的问题的答案是关于项目的GitHub

You can configure via web.xml : 您可以通过web.xml进行配置:

<init-param>
  <param-name>swagger.pretty.print</param-name>
  <param-value>true</param-value>
</init-param>

or via BeanConfig : 或通过BeanConfig

config.setPrettyPrint(true)

I asked a similar question for the Swashbuckle library, here . 在这里向Swashbuckle图书馆提出了类似的问题。 Still waiting for an answer from Swashbuckle team. 仍在等待Swashbuckle团队的回答。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM