12 lines
168 B
Go
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
|
|
}
|