public async Task <IHttpActionResult> Get(string s) { var response = await _api.Get(s); if (response.StatusCode != HttpStatusCode.OK) { return(ResponseMessage(Request.CreateResponse(response.StatusCode, response.Content))); } var result = await response.Content.ReadAsStreamAsync(); var data = JsonConvert.DeserializeObject <SpotifyDto>(await response.Content.ReadAsStringAsync()); var spotify = new Spotify { Tracks = new List <Track>() }; IEnumerable <Dictionary <string, dynamic> > jsonTracks = JsonConvert.DeserializeObject <IEnumerable <Dictionary <string, dynamic> > >(data.Tracks["items"].ToString()); foreach (var item in jsonTracks) { List <Dictionary <string, dynamic> > artistList = JsonConvert.DeserializeObject <List <Dictionary <string, dynamic> > >(item["artists"].ToString()); var halloj = artistList.Select(a => a["name"].ToString()).ToList(); //var testtest = artistList.Select(a => Convert.ToString(a)).ToList(); //var tjo = ((IEnumerable<string>)artistList.Select(a => a["name"].ToString())).ToList(); //var hej = (List<string>)((IEnumerable<string>)artistList.Select(a => a["name"].ToString())).ToList(); spotify.Tracks.Add(new Track { Href = item["href"], Name = item["name"], Id = item["id"], Duration_ms = Convert.ToInt32(item["duration_ms"]), Type = item["type"], Album = JsonConvert.DeserializeObject <Dictionary <string, dynamic> >(item["album"].ToString())["name"], Artist = ConvertToReadableList(artistList.Select(a => a["name"].ToString()).ToList()) }); } if (response.StatusCode == HttpStatusCode.OK) { return(Ok(spotify)); } else { return(BadRequest(response.Content.ToString())); } }