From 48308d45d9da184ead8aa8e79c24036999c491cb Mon Sep 17 00:00:00 2001 From: E Sequeira <5458743+geseq@users.noreply.github.com> Date: Mon, 26 Jun 2023 08:40:49 +0100 Subject: [PATCH] fix json decode (#424) * fix json decode --- stdlib/json/decode.go | 2 +- stdlib/json/json_test.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/stdlib/json/decode.go b/stdlib/json/decode.go index 37432d4..557fb9e 100644 --- a/stdlib/json/decode.go +++ b/stdlib/json/decode.go @@ -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]) diff --git a/stdlib/json/json_test.go b/stdlib/json/json_test.go index b12bd64..031307c 100644 --- a/stdlib/json/json_test.go +++ b/stdlib/json/json_test.go @@ -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) {