go
data_error
ai_generated
true
json: 无法将数字1e+1000解析为int类型
json: cannot unmarshal number 1e+1000 into Go value of type int
ID: go/json-number-overflow
80%修复率
86%置信度
0证据数
2024-11-01首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 1.12 | active | — | — | — |
根因分析
JSON中的数字超出目标Go类型的范围
English
JSON中的数字超出目标Go类型的范围
解决方案
-
90% 成功率
使用json.Number类型
-
85% 成功率
自定义UnmarshalJSON方法
无效尝试
常见但无效的做法:
-
60% 失败
精度丢失
-
70% 失败
仍然溢出