小编KuZ*_*Zon的帖子

在golang中将Json.Number转换为int / int64 / float64

我有一个变量数据,它是一个接口。当我打印其类型时,将其获取为json.Number。如何将强制类型转换为int / int64 / float64

如果我尝试数据。(float64),最终会出现紧急错误

panic: interface conversion: interface {} is json.Number, not float64
Run Code Online (Sandbox Code Playgroud)

go go-interface

0
推荐指数
1
解决办法
7904
查看次数

标签 统计

go ×1

go-interface ×1