1
I’m trying to serialize and deserialize JSON in VB, but I’m not getting the only thought code of deserializar is not working
Imports System.Net
Imports System.IO
Imports System.Web.Script.Serialization
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim uriString As String = "https://api.github.com/users/VitorHugoFra"
Dim uri As New Uri(uriString)
Dim Request As HttpWebRequest = CType(WebRequest.Create(uri), HttpWebRequest)
Request.Method = "GET"
Dim Response As WebResponse = Request.GetResponse()
Dim Read = New StreamReader(Response.GetResponseStream())
Dim Raw As String = Read.ReadToEnd()
Dim dict As Object = New JavaScriptSerializer().Deserialize(Of List(Of (Object, ))(Raw)
For Each item As Object In dict
TextBox1.Text += item("login").ToString + "-" + item("location").ToString + vbNewLine
Next
End Sub
End Class
I found two libraries, A VB-JSON: http://www.ediy.co.nz/vbjson-json-parser-library-in-vb6-xidc55680.html and Chilkat: https://www.example-code.com/vb6/json.asp. The second even has several examples. Check if any fits you.
– Bruno Cunha