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

Method PureJSON

context.go:1217–1219  ·  view source on GitHub ↗

PureJSON serializes the given struct as JSON into the response body. PureJSON, unlike JSON, does not replace special html characters with their unicode entities.

(code int, obj any)

Source from the content-addressed store, hash-verified

1215// PureJSON serializes the given struct as JSON into the response body.
1216// PureJSON, unlike JSON, does not replace special html characters with their unicode entities.
1217func (c *Context) PureJSON(code int, obj any) {
1218 c.Render(code, render.PureJSON{Data: obj})
1219}
1220
1221// XML serializes the given struct as XML into the response body.
1222// It also sets the Content-Type as "application/xml".

Callers 2

Calls 1

RenderMethod · 0.95

Tested by 1