# error: json: Unmarshal(nil *main.MyStruct)

- **ID:** `go/encoding-json-unmarshal-nil-pointer`
- **Domain:** go
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Passing a nil pointer to json.Unmarshal, which cannot unmarshal into a nil target.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 1.20 | active | — | — |
| 1.21 | active | — | — |

## Workarounds

1. **Always initialize the target variable before unmarshaling** (98% success)
   ```
   var myStruct MyStruct
if err := json.Unmarshal(data, &myStruct); err != nil { return err }
   ```

## Dead Ends

- **Ignoring nil check before unmarshaling** — Leads to panic; always initialize target variable. (90% fail)
