# error: json: cannot unmarshal object into Go value of type map[int]string

- **ID:** `go/encoding-json-unmarshal-into-map-with-non-string-key`
- **Domain:** go
- **Category:** type_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

JSON object keys are always strings, but the target map has non-string key type like int.

## Version Compatibility

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

## Workarounds

1. **Use map[string]interface{} and then convert keys** (90% success)
   ```
   var raw map[string]interface{}
json.Unmarshal(data, &raw)
result := make(map[int]string)
for k, v := range raw {
    i, _ := strconv.Atoi(k)
    result[i] = v.(string)
}
   ```

## Dead Ends

- **Using string key map and converting manually** — Works but inefficient; use map[string]interface{} and convert. (40% fail)
