mirror of https://github.com/tidwall/gjson.git
Encode \b and \f in JSON string as themselves
This commit is contained in:
parent
6ee9f877d6
commit
b622071bec
4
gjson.go
4
gjson.go
|
@ -1926,6 +1926,10 @@ func AppendJSONString(dst []byte, s string) []byte {
|
||||||
if s[i] < ' ' {
|
if s[i] < ' ' {
|
||||||
dst = append(dst, '\\')
|
dst = append(dst, '\\')
|
||||||
switch s[i] {
|
switch s[i] {
|
||||||
|
case '\b':
|
||||||
|
dst = append(dst, 'b')
|
||||||
|
case '\f':
|
||||||
|
dst = append(dst, 'f')
|
||||||
case '\n':
|
case '\n':
|
||||||
dst = append(dst, 'n')
|
dst = append(dst, 'n')
|
||||||
case '\r':
|
case '\r':
|
||||||
|
|
Loading…
Reference in New Issue