diff --git a/encoding/json/number.go b/encoding/json/number.go index 5cddf22..936ba86 100644 --- a/encoding/json/number.go +++ b/encoding/json/number.go @@ -1,9 +1,12 @@ package json -import "encoding/json" +import ( + "encoding/json" + "strconv" +) func NumberToInt(n json.Number) (int, error) { - n64, err := n.Int64() + n64, err := strconv.ParseInt(n.String(), 10, 32) if nil != err { return 0, err }