Use struct directly if type matches
diff --git a/mapstructure.go b/mapstructure.go
index 381ba5d..6abe075 100644
--- a/mapstructure.go
+++ b/mapstructure.go
@@ -530,6 +530,12 @@
func (d *Decoder) decodeStruct(name string, data interface{}, val reflect.Value) error {
dataVal := reflect.Indirect(reflect.ValueOf(data))
+
+ if dataVal.Type() == val.Type() {
+ val.Set(dataVal)
+ return nil
+ }
+
dataValKind := dataVal.Kind()
if dataValKind != reflect.Map {
return fmt.Errorf("'%s' expected a map, got '%s'", name, dataValKind)