diff --git a/crunchyroll.go b/crunchyroll.go index 5ee3a97..d20dd20 100644 --- a/crunchyroll.go +++ b/crunchyroll.go @@ -793,8 +793,9 @@ func (c *Crunchyroll) Account() (*Account, error) { } defer resp.Body.Close() - var jsonBody map[string]interface{} - if err = json.NewDecoder(resp.Body).Decode(&jsonBody); err != nil { + account := &Account{} + + if err = json.NewDecoder(resp.Body).Decode(&account); err != nil { return nil, fmt.Errorf("failed to parse 'me' response: %w", err) } @@ -804,15 +805,9 @@ func (c *Crunchyroll) Account() (*Account, error) { } defer resp.Body.Close() - if err = json.NewDecoder(resp.Body).Decode(&jsonBody); err != nil { + if err = json.NewDecoder(resp.Body).Decode(&account); err != nil { return nil, fmt.Errorf("failed to parse 'profile' response: %w", err) } - account := &Account{} - - if err := decodeMapToStruct(jsonBody, account); err != nil { - return nil, err - } - return account, nil }