Example #1
0
func OutputJSON(content []byte, ctx *X.Context, args ...int) (err error) {
	callback := ctx.Query(`callback`)
	code := ctx.Code
	if len(args) > 0 {
		code = args[0]
	}
	if callback != `` {
		content = []byte(callback + "(" + string(content) + ");")
	}
	ctx.Object().JSONBlob(code, content)
	return nil
}