Skip to content

Commit

Permalink
Encode \b and \f in JSON string as themselves
Browse files Browse the repository at this point in the history
  • Loading branch information
V02460 committed Feb 14, 2024
1 parent 6ee9f87 commit b622071
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions gjson.go
Original file line number Diff line number Diff line change
Expand Up @@ -1926,6 +1926,10 @@ func AppendJSONString(dst []byte, s string) []byte {
if s[i] < ' ' {
dst = append(dst, '\\')
switch s[i] {
case '\b':
dst = append(dst, 'b')
case '\f':
dst = append(dst, 'f')
case '\n':
dst = append(dst, 'n')
case '\r':
Expand Down

0 comments on commit b622071

Please sign in to comment.