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)
| 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. |
| 1180 | func (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. |