Deserialize JSON from Spotify: added 1 field but cannot deserialize

First I had this code for calling the API from Spotify:

and deserialize:

Now, I also want to now id from the track.

This is my new code:“+strSpotifyPlaylistCode+”/tracks?market=NL&fields=items(track(name,id),track(artists(name)))”

because in response content (output) the track id is also included:
"{"items":[{"track":{"artists":[{"name":"Vieze Asbak"},{"name":"Joost"}],"name":"Wachtmuziek (Sped Up)","id":"2joc5EdF3gTzvrtjvjKrud"}}


But the deserialization does not work, ID is not added:
DeserializeJSON_d70a20 { items=List(79) { items { track=track { artists=List(2) { artists { name=“Vieze Asbak” }, artists { name=“Joost” } }, name=“Wachtmuziek (Sped Up)” } }

how can i include ID ?

Just a few analysis and clearing steps

Hi Peter, thanks for your reply.
My problem is, I don’t know how to choose the Input Type.
How can I choose the correct input type?

How do I make a general deserialization?

use JObject as Input type and let the sample blank

alright. The output from deserialize json is variable named test4.


Now I want to iterate through the objects, with a for each, but I get this error:

How do I iterate through this json object?

just share the JSON (as Text file) with us, so we can help you with the details.

in the immediate panel, you can get a more readable JSON with test4.toString

1 Like

test4.txt (10.2 KB)

See attachment. I think it is a partial extract, because it ends with …

I think I almost get it working, but cannot call

alright, this works:

““name””: ““Vieze Asbak””
““name””: ““Joost””

but this doesn’t:

is it because there are multiple names under artists?

As all tracks are within a JArray we can loop within a for each activity:

myJObject("items").Values(Of JObject)

and iterate over all items from the “items” Array

Cross Check:

1 Like

thanks! Works like a charm!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.