I'm trying to get data from an API that returns data in the format:
[{
"song": {
"id": 12345,
"track": "TRACK A",
"artist": "ARTIST A"
},
"playedtime": "2018-02-14T09:07:15.976"
}, {
"song": {
"id": 54321,
"track": "TRACK B",
"artist": "ARTIST B"
},
"playedtime": "2018-02-14T09:03:29.355"
}]
I need to get only the first track and artist entry, which in the above example is "TRACK A" and "ARTIST A".
What I've done so far which is probably really wrong is:
string response = await client.GetStringAsync(uri);
JArray parser = JArray.Parse(response);
rootTrack = JObject.Parse(parser.First.ToString())["track"].ToString();
rootArtist = JObject.Parse(parser.First.ToString())["artist"].ToString();