How to loop through streaming platform JSON data

I’m still learning how to work with JSON data and need some help. I’m trying to process user information from a streaming API but can’t figure out the right way to loop through all the entries.

Dim apiUrl = "https://api.example.com/users/" & channelName.Replace("#", "") & "/members"
Dim responseData As String = Nothing
Dim client As New WebClient()
responseData = client.DownloadString(apiUrl)

Dim jsonData As JToken = JToken.Parse(responseData)
For Each entry As JToken In jsonData("members")
    ' Need help here - trying to get each user from the list
Next

The problem is I can’t figure out how to properly access the individual users from the JSON response. What’s the correct approach to get them into a collection that I can work with?

Your code’s close, but you’re missing the actual data extraction step. You’re looping through the entries but not grabbing anything from them.

Try this:

For Each entry As JToken In jsonData("members")
    Dim userId As String = entry("id").ToString()
    Dim userName As String = entry("name").ToString()
    ' Process each user here
Next

Each ‘entry’ is a user object, so you need to pull out the specific properties you want. I’d check the raw JSON response first to see what fields are available, then access those fields in your loop.