Skip to content
This repository was archived by the owner on Dec 15, 2025. It is now read-only.

Commit e7a8aea

Browse files
committed
Merge branch 'master' of https://github.com/json-iterator/go
2 parents 60a9df5 + 7b060ec commit e7a8aea

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

feature_iter_float.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package jsoniter
22

33
import (
4+
"encoding/json"
45
"io"
56
"math/big"
67
"strconv"
@@ -339,3 +340,8 @@ func validateFloat(str string) string {
339340
}
340341
return ""
341342
}
343+
344+
// ReadNumber read json.Number
345+
func (iter *Iterator) ReadNumber() (ret json.Number) {
346+
return json.Number(iter.readNumberAsString())
347+
}

jsoniter_float_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,13 @@ func Test_lossy_float_marshal(t *testing.T) {
192192
should.Equal("0.123457", output)
193193
}
194194

195+
func Test_read_number(t *testing.T) {
196+
should := require.New(t)
197+
iter := ParseString(ConfigDefault, `92233720368547758079223372036854775807`)
198+
val := iter.ReadNumber()
199+
should.Equal(`92233720368547758079223372036854775807`, string(val))
200+
}
201+
195202
func Benchmark_jsoniter_float(b *testing.B) {
196203
b.ReportAllocs()
197204
input := []byte(`1.1123,`)

0 commit comments

Comments
 (0)