MCPcopy
hub / github.com/gin-gonic/gin / IndentedJSON

Method IndentedJSON

context.go:1180–1182  ·  view source on GitHub ↗

IndentedJSON serializes the given struct as pretty JSON (indented + endlines) into the response body. It also sets the Content-Type as "application/json". WARNING: we recommend using this only for development purposes since printing pretty JSON is more CPU and bandwidth consuming. Use Context.JSON()

(code int, obj any)

Source from the content-addressed store, hash-verified

1178// WARNING: we recommend using this only for development purposes since printing pretty JSON is
1179// more CPU and bandwidth consuming. Use Context.JSON() instead.
1180func (c *Context) IndentedJSON(code int, obj any) {
1181 c.Render(code, render.IndentedJSON{Data: obj})
1182}
1183
1184// SecureJSON serializes the given struct as Secure JSON into the response body.
1185// Default prepends "while(1)," to response body if the given struct is array values.

Calls 1

RenderMethod · 0.95