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
Dim jt As JToken = j.SelectToken("['room list']")
Thank you!
0
0
Are there any code examples left?
New code examples in category VBA
-
VBA 2022-03-27 20:55:02 excel vba check if all substrings in list are in string
-
VBA 2022-03-27 20:40:39 excel vba set cell value to empty
-
VBA 2022-03-27 17:05:52 vba simple quote
-
VBA 2022-03-27 14:30:19 textbox find and replace vb
-
VBA 2022-03-27 09:10:21 nested if else in vb.net
-
VBA 2022-03-27 09:10:09 excel vba string to bits
-
VBA 2022-03-25 02:00:15 vba verticalalignment
-
VBA 2022-03-24 12:20:06 Excel web scraping
-
VBA 2022-03-24 10:11:00 excel vba BitToLong
-
VBA 2022-03-21 18:00:05 excel vba save file txt