我同意您需要使用的 JSON 库是位于http://json.codeplex.com/的 Json.NET
因此,给定您的示例 JSON 数组,我创建了以下可用于序列化和反序列化的类:
Public Class Item
Public Property [property]() As Integer
Public Property listofstuff() As Stuff()
Public Property lastproperty() As Integer
End Class
Public Class Stuff
Public Property anotherproperty() As String
Public Property yetanother() As String
End Class
那么您所需要的只是以下代码,以便能够以您想要的大致方式访问数据:
Dim Items = Newtonsoft.Json.JsonConvert.DeserializeObject(Of Item())(json)
Dim MyList = Items.ToDictionary(Function(x) x.property)
Dim Stuff = MyList(96).listofstuff(0)
如果您对属性数组的意图listofstuff
是存储任何字符串对,则将此定义用于Item
(并且您也不需要Stuff
该类):
Public Class Item
Public Property [property]() As Integer
Public Property listofstuff() As Dictionary(Of String, String)()
Public Property lastproperty() As Integer
End Class