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