Unmarshalling JSON (that I do not control) like this:
{
"states": {
"state": [
{ ...}
]
}
}
into a struct like:
type Device struct {
States struct{ State []State }
}
var dev Device
I get an ugly syntax to access a state:
dev.States.State[0]
I would like to be able to transform the object so I can do
dev.States[0]
Can this be done with tags (omitted in the above example because not needed), or with another method, or do I have to first unmarshal to a struct like the above then manually remap to a struct as I want it?