# json: cannot unmarshal array into Go value of type struct { Name string }

- **ID:** `go/json-cannot-unmarshal-array-into-struct`
- **Domain:** go
- **Category:** type_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

JSON data is an array but target Go type is a struct, causing type mismatch.

## Version Compatibility

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

## Workarounds

1. **** (95% success)
   ```
   Unmarshal into []struct{ Name string } if JSON is array: var data []struct{Name string}; json.Unmarshal([]byte(jsonStr), &data)
   ```
2. **** (85% success)
   ```
   Use json.RawMessage to inspect first, then unmarshal accordingly.
   ```

## Dead Ends

- **** — Data not parsed, leads to nil values. (90% fail)
- **** — May not match API contract; breaks other code. (40% fail)
