0
我正在使用simplejson,它提供了类型断言器。golang simplejson mustint64不会从字符串转换为int64
fmt.Printf("%s %s", m.Get("created_time").MustString(), m.Get("created_time").MustInt64())
上面的代码示出了该结果:
1506259900 %!s(int64=0)
所以MustInt64()给出了0,而不是转换的Int64值。
是否因为1506259900太大而无法转换?
感谢您的帮助!
我不认为'simplejson'用'MustInt64'将json字符串值转换为'int64'。你能提供你正试图解析的json吗? – mkopriva
是的,我找到了原因,你绝对是对的。 – kispi