Im calling a API and it returns a dictionary(map) with a list of items as values.
For ex:-
result= {'outputs':[{'state':'md','country':'us'}, {'state':'ny','country':'ny'}]}
The above data is how the data represented in python.
In Python, I directly use result['outputs'][0] to access the list of elements in the list.
In Golang, the same API returns the data but when I try to access the data as result['outputs'][0]
Get this error:-
invalid operation: result["outputs"][0] (type interface {} does not support indexing)
Looks like I need to do a type conversion, what should I use to type convert, I tried this
result["outputs"][0].(List)
result["outputs"][0].([])
but both throws me an error.
I checked the type of the returned item and this is it - []interface {}
What should be my type conversion?