This commit is contained in:
crusader 2017-12-04 18:31:23 +09:00
parent 68a123318d
commit 6cdd0515a5

View File

@ -1,9 +1,12 @@
package json package json
import "encoding/json" import (
"encoding/json"
"strconv"
)
func NumberToInt(n json.Number) (int, error) { func NumberToInt(n json.Number) (int, error) {
n64, err := n.Int64() n64, err := strconv.ParseInt(n.String(), 10, 32)
if nil != err { if nil != err {
return 0, err return 0, err
} }