diff --git a/src/IF.Lastfm.Core/Objects/LastAlbum.cs b/src/IF.Lastfm.Core/Objects/LastAlbum.cs index 78d51fe1..4c1434e8 100644 --- a/src/IF.Lastfm.Core/Objects/LastAlbum.cs +++ b/src/IF.Lastfm.Core/Objects/LastAlbum.cs @@ -71,7 +71,12 @@ internal static LastAlbum ParseJToken(JToken token) { var tagToken = tagsToken.SelectToken("tag"); if (tagToken != null) - a.TopTags = tagToken.Children().Select(LastTag.ParseJToken); + { + a.TopTags = + tagToken.Type == JTokenType.Array + ? tagToken.Children().Select(LastTag.ParseJToken) + : new List { LastTag.ParseJToken(tagToken) }; + } } a.ListenerCount = token.Value("listeners"); diff --git a/src/IF.Lastfm.Core/Objects/LastArtist.cs b/src/IF.Lastfm.Core/Objects/LastArtist.cs index 262c9b10..b1b5128b 100644 --- a/src/IF.Lastfm.Core/Objects/LastArtist.cs +++ b/src/IF.Lastfm.Core/Objects/LastArtist.cs @@ -41,9 +41,16 @@ internal static LastArtist ParseJToken(JToken token) a.OnTour = Convert.ToBoolean(token.Value("ontour")); var tagsToken = token.SelectToken("tags"); - if (tagsToken != null && tagsToken.HasValues) + if (tagsToken != null) { - a.Tags = tagsToken.SelectToken("tag").Children().Select(LastTag.ParseJToken); + var tagToken = tagsToken.SelectToken("tag"); + if (tagToken != null) + { + a.Tags = + tagToken.Type == JTokenType.Array + ? tagToken.Children().Select(LastTag.ParseJToken) + : new List { LastTag.ParseJToken(tagToken) }; + } } var images = token.SelectToken("image"); diff --git a/src/IF.Lastfm.Core/Objects/LastTrack.cs b/src/IF.Lastfm.Core/Objects/LastTrack.cs index 23ad5a42..a69da37d 100644 --- a/src/IF.Lastfm.Core/Objects/LastTrack.cs +++ b/src/IF.Lastfm.Core/Objects/LastTrack.cs @@ -66,9 +66,16 @@ internal static LastTrack ParseJToken(JToken token) } var tagsToken = token.SelectToken("toptags"); - if (tagsToken != null && tagsToken.HasValues) + if (tagsToken != null) { - t.TopTags = tagsToken.SelectToken("tag").Children().Select(LastTag.ParseJToken); + var tagToken = tagsToken.SelectToken("tag"); + if (tagToken != null) + { + t.TopTags = + tagToken.Type == JTokenType.Array + ? tagToken.Children().Select(LastTag.ParseJToken) + : new List { LastTag.ParseJToken(tagToken) }; + } } var date = token.SelectToken("date");