1
我越來越格式化,因爲這如何反序列化JSON結構?
{"UFs": [
{
"Valor": "24.184,92",
"Fecha": "2014-10-07"
}
]}
我想訪問此處顯示的值和日期信息。
我有一類
Public Class clValores
Private pTipoValores As String
Private pValores As String
Public Property Fecha() As String
Get
Return pTipoValores
End Get
Set(ByVal value As String)
pTipoValores = value
End Set
End Property
Public Property Valor() As String
Get
Return pValores
End Get
Set(ByVal value As String)
pValores = value
End Set
End Property
End Class
而這種代碼
Dim webClient As New System.Net.WebClient
Dim result As String = webClient.DownloadString("http://api.sbif.cl/api-sbifv3/recursos_api/uf?apikey=xxxxxxxxxxxxxxxxxxxxxxx&formato=JSON")
Dim Valor As clValores = JsonConvert.DeserializeObject(Of clValores)(result)
Response.Write(Valor.Fecha)
Response.Write(Valor.Valor)
但在運行代碼時勇猛什麼。我缺少
我試過這樣Dim Valor As UFsContainer = JsonConvert.DeserializeObject(Of UFsContainer)(result)但我沒有得到任何東西 – Corobori 2014-10-08 00:20:25
對不起,我剛纔看到clValores是一個數組,所以它應該是一個List(Of clValores)來正確地反序列化它 – Icepickle 2014-10-08 10:40:04