JSON
// JSON contains the options for the JSON (Context's) Renderer.
type JSON struct {
// http-specific
StreamingJSON bool
// content-specific
UnescapeHTML bool
Indent string
Prefix string
ASCII bool
// if true then it prepends a "while(1);" when Go slice (to JSON Array) value.
Secure bool
// proto.Message specific marshal options.
Proto ProtoMarshalOptions
}func handler(ctx iris.Context) {
response := []string{"val1", "val2", "val3"}
options := iris.JSON{Indent: " ", Secure: true}
ctx.JSON(response, options)
}ASCII
UnescapeHTML
Last updated
Was this helpful?