selecttoken em vbnet e json

Option Strict On

Imports Newtonsoft.Json
Imports Newtonsoft.Json.Linq
Imports System.Net.Http
Imports System.IO

Module Module1
    Sub Main()
        Dim t = JsonTestAsync()
        Console.ReadKey()
    End Sub

    Private Async Function JsonTestAsync() As Task
        Using client As New HttpClient
            Dim response = Await client.GetAsync("https://atlas.metabroadcast.com/3.0/channel_groups/cbhJ.json?apiKey={insert your API key}&annotations=channels")
            Using reader As New StreamReader(Await response.Content.ReadAsStreamAsync)
                Using jsonreader = New JsonTextReader(reader)
                    Dim serializer = New JsonSerializer()
                    Dim document As JObject = CType(serializer.Deserialize(jsonreader), JObject)
                    For Each result In document
                        Console.WriteLine(result.Key)
                        For Each channelgroup In result.Value
                            Console.WriteLine("Title = " & channelgroup.Item("title").ToString)
                            Console.WriteLine("ID = " & channelgroup.Item("id").ToString)
                            For Each channel In channelgroup.Item("channels")
                                Dim first = channel.Children.First
                                Dim titleInfo = first.Children.First
                                Dim numberInfo = first.Next
                                Console.WriteLine(numberInfo.Children.First.ToString & " = " & titleInfo.Item("title").ToString)
                            Next
                        Next
                    Next
                End Using
            End Using
        End Using
    End Function
End Module

0
0
Awgiedawgie 440215 points

                                    Dim jt As JToken = j.SelectToken("['room list']")

0
0
Are there any code examples left?
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source