Closed veqryn closed 6 years ago
You can try to do something like
type UnescapableString string
func (s *UnescapableString) MarshalJSON() ([]byte, error) {
// here you don't escape your string or smth like that
}
I am fairly certain that the json package will still escape it after the fact. In any case, it is not feasible to change all my strings to this.
Sorry for the late answer
Did you try to use jwriter? jwriter has option 'NoEscapeHTML' you could try to use.
I have not. That might be what I need.
Hello! Does my suggestion work? If does, can you close the issue, please? :)
Looks like jwriter works.
If possible, it would be great if you could make json.Encoder work too.
Unfortunately, we can not work with json.Encoder now 😢
Ok. Feel free to close this or keep it open in case you can support it in the future.
@rvasily close, please :)
The above will give the correct
{"Thing":"hello <&,.='\"'=.,&> world"}
when not using easyjson. With easyjson, you get:{"Thing":"hello \u003c\u0026,.='\"'=.,\u0026\u003e world"}