# panic: json: unsupported type: chan int

- **ID:** `go/json-marshal-channels`
- **Domain:** go
- **Category:** type_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

尝试将channel或函数等不支持的类型序列化为JSON。

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 1.18 | active | — | — |

## Workarounds

1. **** (95% success)
   ```
   在结构体中使用`json:"-"`忽略字段：
type Message struct {
    Ch chan int `json:"-"`
    Data string `json:"data"`
}
   ```
2. **** (80% success)
   ```
   实现MarshalJSON方法自定义序列化。
   ```

## Dead Ends

- **** — 程序崩溃。 (100% fail)
- **** — json.Marshal不处理channel。 (90% fail)
