mirror of
https://github.com/gin-gonic/gin.git
synced 2025-04-06 03:57:46 +08:00
Merge b34e0714b485ea0b79dfbd7e33938315ef2667be into 8763f33c65f7df8be5b9fe7504ab7fcf20abb41d
This commit is contained in:
commit
a59b060853
@ -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