This commit is contained in:
Pavel Zarubin 2024-11-19 13:32:03 +00:00 committed by GitHub
commit 1ba57f7aed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 14 additions and 1 deletions

View File

@ -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: