I have a struct:
type ListsObj struct {
Page string `json:"pages"`
Count string `json:"count"`
Lists []map[string]interface{} `json:"assets"`
}
I am trying to do something like below:
lists := a.Lists
for _, list:= range lists{
listData := list.(map[string]interface {})
}
a is of type ListsObj struct.
I am getting following error:
invalid type assertion: list.(map[string]) (non-interface type map[string]interface {} on left)
EDIT: What I actually need to do is to call a function:
func WriteMapper(a interface {}) interface{} {
}
lists := a.Lists
for _, list:= range lists{
list = WriteMapper(list)
}
but this gives another error:
cannot use WriteMapper(list) (type interface {}) as type map[string]interface {} in assignment: needs type assertion
EDIT: I think I got it... the function returns interface and I am trying to assign that to map[string]interface {}??