1
After taking some data from an endpoint I get passes to a variable of type interface{}
;
var example interface{}
err := json.Unmarshal(payload, &example)
If I run a fmt.Println(example)
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]]
In case I try to access some value with example["ticker"]
I have 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 (what is correct).
But if I can store the data in one interface{}
consequently I could access them correctly? how can I access this data without this error in the compilation?