mirror of https://github.com/goccy/go-json.git
Fix decoding of struct type
This commit is contained in:
parent
9053c385ea
commit
98824e9bd9
|
@ -483,6 +483,7 @@ func (d *structDecoder) decodeStream(s *stream, p unsafe.Pointer) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
s.cursor++
|
s.cursor++
|
||||||
|
s.skipWhiteSpace()
|
||||||
if s.char() == '}' {
|
if s.char() == '}' {
|
||||||
s.cursor++
|
s.cursor++
|
||||||
return nil
|
return nil
|
||||||
|
@ -551,10 +552,12 @@ func (d *structDecoder) decode(buf []byte, cursor int64, p unsafe.Pointer) (int6
|
||||||
default:
|
default:
|
||||||
return 0, errNotAtBeginningOfValue(cursor)
|
return 0, errNotAtBeginningOfValue(cursor)
|
||||||
}
|
}
|
||||||
if buflen < 2 {
|
|
||||||
return 0, errUnexpectedEndOfJSON("object", cursor)
|
|
||||||
}
|
|
||||||
cursor++
|
cursor++
|
||||||
|
cursor = skipWhiteSpace(buf, cursor)
|
||||||
|
if buf[cursor] == '}' {
|
||||||
|
cursor++
|
||||||
|
return cursor, nil
|
||||||
|
}
|
||||||
for {
|
for {
|
||||||
c, field, err := d.keyDecoder(d, buf, cursor)
|
c, field, err := d.keyDecoder(d, buf, cursor)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue