2,892 questions
Try something like this:
Imports System.IO
Imports System.Net.Http
Imports System.Text.Json
. . .
Private Async Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
RichTextBox1.Text = "Loading data..."
RichTextBox1.Update()
Using http = New HttpClient
Dim url = "https://api-cloud.bitmart.com/account/v1/currencies"
Dim s As Stream = Await http.GetStreamAsync(url)
Dim r As Response = Await JsonSerializer.DeserializeAsync(Of Response)(s)
RichTextBox1.Text = ""
For Each c In r.data.currencies
RichTextBox1.AppendText(c.currency & vbCrLf)
Next
End Using
End Sub
Class Response
Public Property data As Data
End Class
Class Data
Public Property currencies As Currency()
End Class
Class Currency
Public Property currency As String
End Class
You can extend the Currency class to include more properties according to JSON.
In case of .NET Framework, use NuGet Manager to add a reference to "System.Text.Json" package.