gjson icon indicating copy to clipboard operation
gjson copied to clipboard

How to disable HTML escaping?

Open mattjohnsonpint opened this issue 1 year ago • 1 comments

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.

mattjohnsonpint avatar Jul 02 '24 17:07 mattjohnsonpint

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

tidwall avatar Jul 30 '24 11:07 tidwall