转换类型方法备注
Json.Number to float64val.(json.Number).Float64()直接将json反解析时会遇到: panic: interface conversion: interface {} is json.Number, not float64
Json.Number to int64val.(json.Number).Int64()直接将json反解析时会遇到: panic: interface conversion: interface {} is json.Number, not int64
int64 to intint(val)
int64 to int32int32(val)
int64 to stringstrconv.FormatInt(val, 10)
int32 to stringstrconv.FormatInt(int64(val), 10)
int to stringstrconv.Itoa(val)
string to intstrconv.Atoi(val)
string to int64strconv.ParseInt(val, 10, 64)
interface{} to intval.(int)
interface{} to stringval.(string)