Skip to content

Commit

Permalink
fix json decode (#424)
Browse files Browse the repository at this point in the history
* fix json decode
  • Loading branch information
geseq committed Jun 26, 2023
1 parent 55f2519 commit 48308d4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion stdlib/json/decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down
1 change: 1 addition & 0 deletions stdlib/json/json_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 48308d4

Please sign in to comment.