tidwall / gjson

Get JSON values quickly - JSON parser for Go
MIT License
14.39k stars 857 forks source link

How to disable HTML escaping? #362

Open mattjohnsonpint opened 4 months ago

mattjohnsonpint commented 4 months ago

It seems that gjson.AppendJsonString always escapes HTML characters.

https://github.com/tidwall/gjson/blob/c2bc5a409a229e55cd1ba59b6cfd5fe1488d6f0f/gjson.go#L1943-L1945

Can we get an option to disable that for non-HTML scenarios?

There is precedent with other encoders:

Thanks.

tidwall commented 3 months ago

Version 1.17.3 adds the gjson.DisableEscapeHTML flag will allow for disabling HTML escaping.