mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-14 12:12:12 +08:00
Merge b34e0714b485ea0b79dfbd7e33938315ef2667be into 77d70e5858278193abfab732164b0c1415d8d4ba
This commit is contained in:
commit
70f7172834
@ -333,7 +333,20 @@ func setWithProperType(val string, value reflect.Value, field reflect.StructFiel
|
||||
case multipart.FileHeader:
|
||||
return nil
|
||||
}
|
||||
return json.Unmarshal(bytesconv.StringToBytes(val), value.Addr().Interface())
|
||||
|
||||
err := json.Unmarshal(bytesconv.StringToBytes(val), value.Addr().Interface())
|
||||
|
||||
if err == nil {
|
||||
return err
|
||||
}
|
||||
|
||||
mv, err := json.Marshal(val)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return json.Unmarshal(mv, value.Addr().Interface())
|
||||
case reflect.Map:
|
||||
return json.Unmarshal(bytesconv.StringToBytes(val), value.Addr().Interface())
|
||||
case reflect.Ptr:
|
||||
|
Loading…
x
Reference in New Issue
Block a user