util/encoding/json/number.go
crusader 2049abfd2f ing
2017-12-04 17:59:56 +09:00

12 lines
168 B
Go

package json
import "encoding/json"
func NumberToInt(n json.Number) (int, error) {
n64, err := n.Int64()
if nil != err {
return 0, err
}
return int(n64), nil
}