context_17.go 507 B

1234567891011121314151617
  1. // Copyright 2018 Gin Core Team. All rights reserved.
  2. // Use of this source code is governed by a MIT style
  3. // license that can be found in the LICENSE file.
  4. // +build go1.7
  5. package gin
  6. import (
  7. "github.com/gin-gonic/gin/render"
  8. )
  9. // PureJSON serializes the given struct as JSON into the response body.
  10. // PureJSON, unlike JSON, does not replace special html characters with their unicode entities.
  11. func (c *Context) PureJSON(code int, obj interface{}) {
  12. c.Render(code, render.PureJSON{Data: obj})
  13. }