From b622071bec9542f978e394935aa5193d056e8e1c Mon Sep 17 00:00:00 2001 From: "Kai A. Hiller" Date: Wed, 14 Feb 2024 21:14:05 +0100 Subject: [PATCH] Encode \b and \f in JSON string as themselves --- gjson.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gjson.go b/gjson.go index 7949825..4acd087 100644 --- a/gjson.go +++ b/gjson.go @@ -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':