# JSON输入意外结束

- **ID:** `go/json-unexpected-end-of-input`
- **领域:** go
- **类别:** data_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

正在解码的JSON数据不完整或被截断，通常是由于网络问题或过早的EOF。

## 版本兼容性

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

## 解决方案

1. **** (85% 成功率)
   ```
   dec := json.NewDecoder(strings.NewReader(data))
if err := dec.Decode(&v); err != nil {
    // handle error
}
   ```
2. **** (80% 成功率)
   ```
   Use json.Valid() to check before unmarshaling.
   ```

## 无效尝试

- **** — The issue is not missing newline but incomplete JSON structure. (80% 失败率)
- **** — Unmarshal requires complete JSON; partial data will still fail. (90% 失败率)
