Your variable is map[string]interface {}
, which means the key is a string, but the value can be anything. In general, access to this:
mvVar := myMap[key].(VariableType)
Or in the case of a string value:
id := res["strID"].(string)
Note that this will panic if the type is incorrect or the key does not exist on the map, but I suggest you learn more about Go maps and claim types.
Read about maps here: http://golang.org/doc/effective_go.html#maps
And about type assertions and interface transformations here: http://golang.org/doc/effective_go.html#interface_conversions
A safe way to do this without the possibility of panic is this:
var id string var ok bool if x, found := res["strID"]; found { if id, ok = x.(string); !ok {
source share