Skip to content

Commit

Permalink
fix encoding RawMessage that contains leading space.
Browse files Browse the repository at this point in the history
  • Loading branch information
extemporalgenome committed Nov 25, 2023
1 parent 3b49d71 commit d34819b
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 1 deletion.
1 change: 1 addition & 0 deletions json/encode.go
Original file line number Diff line number Diff line change
Expand Up @@ -858,6 +858,7 @@ func (e encoder) encodeRawMessage(b []byte, p unsafe.Pointer) ([]byte, error) {
s = v
} else {
var err error
v = skipSpaces(v) // don't assume that a RawMessage starts with a token.
d := decoder{}
s, _, _, err = d.parseValue(v)
if err != nil {
Expand Down
1 change: 0 additions & 1 deletion json/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,6 @@ func (d decoder) parseValue(b []byte) ([]byte, []byte, Kind, error) {
case '{':
v, b, k, err = d.parseObject(b)
case '[':
k = Array
v, b, k, err = d.parseArray(b)
case '"':
v, b, k, err = d.parseString(b)
Expand Down

0 comments on commit d34819b

Please sign in to comment.