var v []int
fmt.Println(json.Unmarshal([]byte(`["foo"]`), &v))

v1 error: "json: cannot unmarshal string into Go value of type int" v1-wrapping-v2 error: "json: cannot unmarshal string into Go struct field .0 of type int"

But there's no struct involved.

The plain v2 error is better, probably fine: json: cannot unmarshal JSON string into Go int within "/0"

Comment From: neild

/cc @dsnet

Comment From: gabyhelp

Related Issues

(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)