Imports Newtonsoft.Json

 

Public Class Form1

 

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click

 

        Dim strmsg As String = "[{'userid':1,'username':'Steve','location':'Willingboro','Titles':['Director MIS','Programmer']},{'userid':2,'username':'Rebee','location':'Venice','Titles':['Good Girl','Cool Person']}]”

 

        ‘This “of List(of” works because our json string starts with an array “[“, not an object {users

        Dim user = JsonConvert.DeserializeObject(Of List(Of UserDetails))(strmsg)

 

        Dim i As Integer

        For i = 0 To user.Count - 1

            MsgBox(user(i).username)

            MsgBox(user(i).Titles(0))

        Next i

 

    End Sub

End Class

 

 

 

Public Class UserDetails

 

    Public Property userid() As Integer

 

    Private m_username As String

    Public Property username() As String

 

    Private m_location As String

    Public Property location() As String

 

    Public Property Titles As IList ‘A generic collection of objects that can be individually accessed by index

 

End Class