fix json decode (#424)

* fix json decode
This commit is contained in:
E Sequeira 2023-06-26 08:40:49 +01:00 committed by GitHub
parent 55f2519b16
commit 48308d45d9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View file

@ -65,7 +65,7 @@ func (d *decodeState) scanNext() {
func (d *decodeState) scanWhile(op int) (isFloat bool) {
s, data, i := &d.scan, d.data, d.off
for i < len(data) {
if data[i] == '.' {
if data[i] == '.' || data[i] == 'e' || data[i] == 'E' {
isFloat = true
}
newOp := s.step(s, data[i])

View file

@ -59,6 +59,7 @@ func TestJSON(t *testing.T) {
"arr": ARR{1, 2, 3, MAP{"a": false, "b": 109.4}}})
testJSONEncodeDecode(t, MAP{"id1": 7075984636689534001, "id2": 7075984636689534002})
testJSONEncodeDecode(t, ARR{1e3, 1E7})
}
func TestDecode(t *testing.T) {