Imports Newtonsoft.Json
' 创建一个类来存储 JSON 数据
Public Class Person
Public Property Name As String
Public Property Age As Integer
End Class
' 读取 JSON 数据
Sub ReadJsonData()
Dim json As String = "{""Name"":""John Smith"",""Age"":30}"
Dim person As Person = JsonConvert.DeserializeObject(Of Person)(json)
Console.WriteLine("Name: " & person.Name)
Console.WriteLine("Age: " & person.Age)
End Sub
linq的话
Dim query = From p In jObject _
Where p.Value(Of Integer)("Age") > 25 _
Select p.Value(Of String)("Name")
For Each name As String In query
Console.WriteLine(name)
Next