ing
This commit is contained in:
parent
68a123318d
commit
6cdd0515a5
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user