# pydantic.errors.JsonError: 无效的 JSON

- **ID:** `python/pydantic-json-load-error`
- **领域:** python
- **类别:** data_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

使用 Json 类型时，输入字符串不是有效的 JSON，导致解析失败。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 2.x | active | — | — |

## 解决方案

1. **** (90% 成功率)
   ```
   Use Json type: data: Json
   ```
2. **** (85% 成功率)
   ```
   Validate with custom validator: @field_validator('data') def check_json(cls, v): json.loads(v); return v
   ```

## 无效尝试

- **** — If input is already a dict, json.loads fails; Pydantic expects string. (60% 失败率)
- **** — Empty string is not valid JSON. (80% 失败率)
