After getting some data from an endpoint I can pass them to a variable of type interface{}
;
var example interface{}
err := json.Unmarshal(payload, &example)
If I run a fmt.Println(example)
I have the following data:
map[ticker:map[last:28533.87000000 buy:28320.00006000 sell:28533.79000000 date:1.527794277e+09 high:28599.00000000 low:27700.00001000 vol:55.58867619]]
If I try to access some value with example["ticker"]
I get the following error:
invalid operator: quotation ["ticker"] (type interface does not support indexing)
Before compiling the code the analysis done is that type interface
has no indices (which is correct).
But if I can store the data in a interface{}
consequently I could access them correct? how can I access this data without this compile error occurring?