I’m trying to decode the following JSON data with contains variable field names.
{
"1": {
"id": 1,
"name": "Random name"
},
"2": {
"id": 2,
"name": "Different name"
}
}
I have the sub struct for the categories itself.
type Cat struct {
ID string `json:"id"`
Name string `json:"name"`
}
I need to wap something around it with map[string]interface{} probably, but I don’t get it working. Can anyone help me with this?
1