Casting interface{} to calculated in runtime Type

Use the following code to create a copy of the draft struct and unmarshal to it:

t := reflect.TypeOf(methodsMap[Method(base.Method)])
pv := reflect.New(t)
err := json.Unmarshal(p, pv.Interface())
return pv.Elem().Interface(), err  // pv.Elem() dereferences ptr 

playground example