我有这个JSON字符串:
{
"Store": [{
"StoreID": "8643",
"IsDeliveryStore": true,
"MinDistance": 0.6,
"MaxDistance": 0.6,
"Phone": "352-505-5557",
"AddressDescription": "3581 sw archer rd\nGainesville, FL 32608",
"HolidaysDescription": "",
"HoursDescription": "Mo-Fr 9:30am-4:00am\nSa-Su 10:00am-4:00am",
"ServiceHoursDescription": {
"Carryout": "Mo-Fr 9:30am-4:00am\nSa-Su 10:00am-4:00am",
"Delivery": "Mo-Fr 9:30am-4:00am\nSa-Su 10:00am-4:00am"
},
"IsOnlineCapable": true,
"IsOnlineNow": true,
"IsNEONow": false,
"IsSpanish": true,
"LocationInfo": null,
"LanguageLocationInfo": {
"es": null
},
"AllowDeliveryOrders": true,
"AllowCarryoutOrders": true,
"IsOpen": true,
"ServiceIsOpen": {
"Carryout": true,
"Delivery": true
}
}, {
"StoreID": "3214",
"IsDeliveryStore": false,
"MinDistance": 2.1,
"MaxDistance": 2.1,
"Phone": "352-377-4992",
"AddressDescription": "3309 W University Ave\nGainesville, FL 32607\nIn Publix Plazza.",
"HolidaysDescription": "",
"HoursDescription": "Su-Th 10:00am-3:00am\nFr-Sa 10:00am-4:00am",
"ServiceHoursDescription": {
"Carryout": "Su-Th 10:00am-3:00am\nFr-Sa 10:00am-4:00am",
"Delivery": "Su-Th 10:00am-3:00am\nFr-Sa 10:00am-4:00am"
},
"IsOnlineCapable": true,
"IsOnlineNow": true,
"IsNEONow": false,
"IsSpanish": false,
"LocationInfo": "In Publix Plazza.",
"LanguageLocationInfo": {
"es": "In Publix Plazza."
},
"AllowDeliveryOrders": true,
"AllowCarryoutOrders": true,
"IsOpen": true,
"ServiceIsOpen": {
"Carryout": true,
"Delivery": true
}
}, {
"StoreID": "3172",
"IsDeliveryStore": false,
"MinDistance": 2.7,
"MaxDistance": 2.7,
"Phone": "352-373-8888",
"AddressDescription": "5750 SW 75th Ct #40\nGainesville, FL 32608\nIn Park Lane Plaza .",
"HolidaysDescription": "",
"HoursDescription": "Su-Th 10:00am-1:00am\nFr-Sa 10:00am-2:00am",
"ServiceHoursDescription": {
"Carryout": "Su-Th 10:00am-1:00am\nFr-Sa 10:00am-2:00am",
"Delivery": "Su-Th 10:00am-1:00am\nFr-Sa 10:00am-2:00am"
},
"IsOnlineCapable": true,
"IsOnlineNow": true,
"IsNEONow": false,
"IsSpanish": true,
"LocationInfo": "In Park Lane Plaza .",
"LanguageLocationInfo": {
"es": "In Park Lane Plaza ."
},
"AllowDeliveryOrders": true,
"AllowCarryoutOrders": true,
"IsOpen": true,
"ServiceIsOpen": {
"Carryout": true,
"Delivery": true
}
}, {
"StoreID": "5150",
"IsDeliveryStore": false,
"MinDistance": 2.9,
"MaxDistance": 2.9,
"Phone": "352-373-2337",
"AddressDescription": "2106 Sw 13th St\nGainesville, FL 32608\nIn Domino's Plaza.",
"HolidaysDescription": "",
"HoursDescription": "Mo-Fr 9:30am-4:00am\nSa-Su 10:00am-4:00am",
"ServiceHoursDescription": {
"Carryout": "Mo-Fr 9:30am-4:00am\nSa-Su 10:00am-4:00am",
"Delivery": "Mo-Fr 9:30am-4:00am\nSa-Su 10:00am-4:00am"
},
"IsOnlineCapable": true,
"IsOnlineNow": false,
"IsNEONow": false,
"IsSpanish": false,
"SubstitutionStore": "3213",
"LocationInfo": "In Domino's Plaza.",
"LanguageLocationInfo": {
"es": "In Domino's Plaza."
},
"AllowDeliveryOrders": true,
"AllowCarryoutOrders": true,
"IsOpen": true,
"ServiceIsOpen": {
"Carryout": true,
"Delivery": true
}
}, {
"StoreID": "3246",
"IsDeliveryStore": false,
"MinDistance": 4.5,
"MaxDistance": 4.5,
"Phone": "352-692-2222",
"AddressDescription": "4620 NW 39th Ave\nGainesville, FL\nLocated at Magnolia Park.",
"HolidaysDescription": "",
"HoursDescription": "Su-Th 10:00am-12:00am\nFr-Sa 10:00am-1:30am",
"ServiceHoursDescription": {
"Carryout": "Su-Th 10:00am-12:00am\nFr-Sa 10:00am-1:30am",
"Delivery": "Su-Th 10:00am-12:00am\nFr-Sa 10:00am-1:30am"
},
"IsOnlineCapable": true,
"IsOnlineNow": true,
"IsNEONow": false,
"IsSpanish": true,
"LocationInfo": "Located at Magnolia Park.",
"LanguageLocationInfo": {
"es": "Located at Magnolia Park."
},
"AllowDeliveryOrders": true,
"AllowCarryoutOrders": true,
"IsOpen": true,
"ServiceIsOpen": {
"Carryout": true,
"Delivery": true
}
}, {
"StoreID": "3261",
"IsDeliveryStore": false,
"MinDistance": 4.7,
"MaxDistance": 4.7,
"Phone": "352-505-6845",
"AddressDescription": "3000 NW 83rd Street\nGainesville, FL 32606\nLocated at the Food Court of Santa Fe College (Bldg R).",
"HolidaysDescription": "",
"HoursDescription": "Mo-Fr 8:30am-5:00pm\nSa-Su Closed",
"ServiceHoursDescription": {
"Carryout": "Mo-Fr 8:30am-5:00pm\nSa-Su Closed",
"Delivery": "Mo-Fr 8:30am-5:00pm\nSa-Su Closed"
},
"IsOnlineCapable": true,
"IsOnlineNow": true,
"IsNEONow": false,
"IsSpanish": true,
"LocationInfo": "Located at the Food Court of Santa Fe College (Bldg R).",
"LanguageLocationInfo": {
"es": "Located at the Food Court of Santa Fe College (Bldg R)."
},
"AllowDeliveryOrders": true,
"AllowCarryoutOrders": true,
"IsOpen": true,
"ServiceIsOpen": {
"Carryout": true,
"Delivery": true
}
}, {
"StoreID": "3213",
"IsDeliveryStore": false,
"MinDistance": 4.7,
"MaxDistance": 4.7,
"Phone": "352-373-5555",
"AddressDescription": "25 Nw 16th Ave\nGainesville, FL 32601\nOn the north corner of Main Street and NW 16th avenue.",
"HolidaysDescription": "",
"HoursDescription": "Su-Th 10:00am-3:00am\nFr-Sa 10:00am-4:00am",
"ServiceHoursDescription": {
"Carryout": "Su-Th 10:00am-3:00am\nFr-Sa 10:00am-4:00am",
"Delivery": "Su-Th 10:00am-3:00am\nFr-Sa 10:00am-4:00am"
},
"IsOnlineCapable": true,
"IsOnlineNow": true,
"IsNEONow": false,
"IsSpanish": false,
"LocationInfo": "On the north corner of Main Street and NW 16th avenue.",
"LanguageLocationInfo": {
"es": "On the north corner of Main Street and NW 16th avenue."
},
"AllowDeliveryOrders": true,
"AllowCarryoutOrders": true,
"IsOpen": true,
"ServiceIsOpen": {
"Carryout": true,
"Delivery": true
}
}]
}
我正在尝试解析这个,这是我的代码:
Dim StoreWrapper = JsonConvert.DeserializeObject(Of StoreWrapper)(html)
Dim AllStores = StoreWrapper.Stores
Results.Text = AllStores(1).StoreID.ToString
Public Class StoreWrapper
Public Property Store As List(Of Store)
End Class
Public Class Store
Public Property StoreID As String
Public Property IsDeliveryStore As Boolean
Public Property MinDistance As Double
Public Property MaxDistance As Double
Public Property Phone As String
Public Property AddressDescription As String
Public Property HolidaysDescription As String
Public Property HoursDescription As String
'Public Property ServiceHoursDescription As String
Public Property IsOnlineCapable As Boolean
Public Property IsOnlineNow As Boolean
Public Property IsNEONow As Boolean
Public Property IsSpanish As Boolean
Public Property LocationInfo As String
'Public Property LanguageLocationInfo As String
Public Property AllowDeliveryOrders As Boolean
Public Property AllowCarryoutOrders As Boolean
Public Property IsOpen As Boolean
'Public Property ServiceIsOpen As String
End Class
我得到的错误是:
LocationFinder.exe中出现未处理的“System.NullReferenceException”类型异常
附加信息:未将对象引用设置为对象的实例。
答案 0 :(得分:0)
所需的改变是
Public Property Store As List(Of Store)
谢谢!