diff options
Diffstat (limited to 'vendor/github.com/SevereCloud/vksdk/v2/object/users.go')
-rw-r--r-- | vendor/github.com/SevereCloud/vksdk/v2/object/users.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/vendor/github.com/SevereCloud/vksdk/v2/object/users.go b/vendor/github.com/SevereCloud/vksdk/v2/object/users.go index 07e1049f..c578c489 100644 --- a/vendor/github.com/SevereCloud/vksdk/v2/object/users.go +++ b/vendor/github.com/SevereCloud/vksdk/v2/object/users.go @@ -1,6 +1,8 @@ package object // import "github.com/SevereCloud/vksdk/v2/object" import ( + "bytes" + "encoding/json" "fmt" ) @@ -233,6 +235,28 @@ type UsersPersonal struct { ReligionID int `json:"religion_id"` } +// UnmarshalJSON UsersPersonal. +// +// BUG(VK): UsersPersonal return []. +func (personal *UsersPersonal) UnmarshalJSON(data []byte) error { + if bytes.Equal(data, []byte("[]")) { + return nil + } + + type renamedUsersPersonal UsersPersonal + + var r renamedUsersPersonal + + err := json.Unmarshal(data, &r) + if err != nil { + return err + } + + *personal = UsersPersonal(r) + + return nil +} + // UsersRelative struct. type UsersRelative struct { BirthDate string `json:"birth_date"` // Date of child birthday (format dd.mm.yyyy) |