Hi,
How to unmarshall /rest/system/connections
in Golang?
I mean I know how to use json.Unmarshall()
, I’m not sure how to construct right struct since the json has dynamic keys. I tried everything including lots of examples from the web and can’t get it going.
This is what I have right now:
type ConnectionInfo struct {
Connections struct {
Device map[string]struct {
At string `json:"at"`
...
}
} `json:"connections"`
Total struct {
At string `json:"at"`
...
} `json:"total"`
}
Total.At
is fine but I can’t map deviceIDs in to map keys.
Do I have to resort to using map[string]interface{}
, or is there a better struct that I could use?
Any help would be appreciated!
1 post - 1 participant