Part of the JSON I'm trying to unmarshal has an array that can contain either strings or ints. How would I go about parsing this?
{
"id": "abc",
"values": [1,2,3]
},
{
"id": "def",
"values": ["elephant", "tomato", "arrow"]
},
{
//etc...
}
I tried the following:
type Thing struct {
ID string `json:"id"`
Values []string `json:"values,string,omitempty"`
}
Get the following error:
panic: json: cannot unmarshal array into Go struct field Thing.values of type string