I'm new to the golang and I have problem while reading the nested JSON response.
var d interface{}
json.NewDecoder(response.Body).Decode(&d)
test :=d["data"].(map[string]interface{})["type"]
response.Body
looks like this
{
"links": {
"self": "/domains/test.one"
},
"data": {
"type": "domains",
"id": "test.one",
"attributes": {
"product": " Website",
"package": "Professional",
"created_at": "2016-08-19T11:37:01Z"
}
}
}
The Error I'm getting is this:
invalid operation: d["data"] (type interface {} does not support indexing)