JSON serializes the given struct as JSON into the response body. It also sets the Content-Type as "application/json".
(code int, obj any)
| 1203 | // JSON serializes the given struct as JSON into the response body. |
| 1204 | // It also sets the Content-Type as "application/json". |
| 1205 | func (c *Context) JSON(code int, obj any) { |
| 1206 | c.Render(code, render.JSON{Data: obj}) |
| 1207 | } |
| 1208 | |
| 1209 | // AsciiJSON serializes the given struct as JSON into the response body with unicode to ASCII string. |
| 1210 | // It also sets the Content-Type as "application/json". |
no test coverage detected