# json: 无法将数字反序列化为 Go 结构体字段 Age 的字符串类型

- **ID:** `go/encoding-json-type-mismatch`
- **领域:** go
- **类别:** type_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

JSON 数据包含数字值，而 Go 结构体期望字符串，导致反序列化时类型不匹配。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 1.20 | active | — | — |

## 解决方案

1. **** (85% 成功率)
   ```
   type Person struct { Age string `json:"age"` }; var p Person; if err := json.Unmarshal(data, &p); err != nil { ... }; // or use custom UnmarshalJSON
   ```

## 无效尝试

- **** — Loses type safety and requires manual type assertions, increasing complexity. (80% 失败率)
- **** — Silently drops data, leading to incorrect application behavior. (90% 失败率)
