Private Function JsonResult1(ByVal JsonText As String) As List(Of String)
Dim lstResult As New List(Of String)
Dim json2 As Object = CType(JsonConvert.DeserializeObject(JsonText), JObject)
Dim Object1 As Object = json2("6902083881405")
Dim json3 As Object = CType(JsonConvert.DeserializeObject(Object1.ToString()), JObject)
Dim name As Object =json3("name")
Dim spec As Object = json3("spec")
Dim price As Object = json3("price")
Dim unit As Object = json3("unit")
lstResult.Add("编码:" & "6902083881405")
lstResult.Add("名称:" & name.ToString)
lstResult.Add("规格:" & spec.ToString)
lstResult.Add("零售价:" & price.ToString)
lstResult.Add("单位:" & unit.ToString)
Return lstResult
End Function
Dim Object1 As Object = json2("6902083881405")
Dim json3 As Object = CType(JsonConvert.DeserializeObject(Object1.ToString()), JObject)
Dim name As Object =json3("name")
Dim spec As Object = json3("spec")
Dim price As Object = json3("price")
Dim unit As Object = json3("unit")
红色部分报错:.NET Compact Framework 的目标版本不支持后期绑定
请问有没有什么变通的方法,折腾了一天了,请高手指点,谢谢!
------解决思路----------------------
Private Function JsonResult1(ByVal JsonText As String) As List(Of String)
Dim lstResult As New List(Of String)
Dim json2 As <span style="color: #FF0000;">JObject</span> = CType(JsonConvert.DeserializeObject(JsonText), JObject)
Dim Object1 As Object = json2("6902083881405")
Dim json3 As <span style="color: #FF0000;">JObject</span> = CType(JsonConvert.DeserializeObject(Object1.ToString()), JObject)
Dim name As Object =json3("name")
Dim spec As Object = json3("spec")
Dim price As Object = json3("price")
Dim unit As Object = json3("unit")
lstResult.Add("编码:" & "6902083881405")
lstResult.Add("名称:" & name.ToString)
lstResult.Add("规格:" & spec.ToString)
lstResult.Add("零售价:" & price.ToString)
lstResult.Add("单位:" & unit.ToString)
Return lstResult
End Function