Skip to content
Discussion options

You must be logged in to vote

It's possible to specify your own JSONSerializer instead of the default one and set enc.SetEscapeHTML(false) during serialization:

e := echo.New() e.JSONSerializer = &MyJSONSerializer{} ...
// DefaultJSONSerializer implements JSON encoding using encoding/json. type MyJSONSerializer echo.DefaultJSONSerializer // Serialize converts an interface into a json and writes it to the response. // You can optionally use the indent parameter to produce pretty JSONs. func (d MyJSONSerializer) Serialize(c echo.Context, i interface{}, indent string) error { enc := json.NewEncoder(c.Response()) enc.SetEscapeHTML(false) if indent != "" { enc.SetIndent("", indent)	} return enc.Encode(i) } // De…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by qulxizer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants