问题描述
您好。
我还有另一个JSON反序列化问题,令我感到沮丧。我之前遇到过反序列化问题( []),这很快就解决了。但我按照步骤重复使用另一个JSON字符串,并且它抛出相同的错误。这是我试图反序列化的代码:
Hello.
I have yet another JSON deserialisation problem, and it's frustrating me. I have had a previous deserialisation problem (How do I deserialise "multi-level" JSON in VB.NET?[^]), and that was solved quickly. But I followed the steps to repeat that with yet another JSON string, and it's throwing the same error. Here is the code I am trying to deserialise:
{"timestamp":1470270507172,"profileId":"e7cc8ec97b294d2484843d330f136bbd","profileName":"iProgramIt","textures":{"SKIN":{"url":"http://textures.minecraft.net/texture/f7f6f0e6a2a3d6db69a4afa9fef28ea4d56f37199277f95c1d2b5f0aaa4e2"}}}
它被卡住了类型SKIN。
这是我在VB.NET中的代码。
It gets stuck on type SKIN.
Here is MY code in VB.NET.
Public Class SKIN
Public Property url As List(Of String)
End Class
Public Class CAPE
Public Property url As List(Of String)
End Class
Public Class PropertyX
Public Property name As String
Public Property value As String
Public Property signature As String
End Class
Public Class Skins_Base
Public Property id As String
Public Property name As String
Public Property properties As List(Of PropertyX)
End Class
Public Class Textures
Public Property SKIN As List(Of SKIN)
Public Property CAPE As List(Of CAPE)
End Class
Public Class Skins
Public Property timestamp As String
Public Property profileId As String
Public Property profileName As String
Public Property isPublic As String
Public Property textures As List(Of Textures)
End Class
Public Function GETX(ByVal Str As String) As String
Dim wc As New System.Net.WebClient
Return wc.DownloadString(Str)
End Function
反序列化(发生错误的地方):
Deserialisation (where the error occurs):
Dim SkinsBase As String = GETX("https://sessionserver.mojang.com/session/minecraft/profile/" & obj.id)
Dim xObj = JsonConvert.DeserializeObject(Of Skins_Base)(SkinsBase)
Dim b As Byte() = Convert.FromBase64String(xObj.properties(0).value)
Dim bString As String = System.Text.Encoding.UTF8.GetString(b)
Dim b64 = JsonConvert.DeserializeObject(Of Skins)(bString)
MsgBox(b64.textures(0).SKIN(0).url(0))
提前谢谢。
-iProgramIt
我的尝试:
http://www.code project.com/Questions/1116304/How-do-I-deserialise-multi-level-JSON-in-VB-NET。现在没有解决这个问题。谷歌搜索,没有任何东西匹配这种情况。
Thank you in advance.
-iProgramIt
What I have tried:
http://www.codeproject.com/Questions/1116304/How-do-I-deserialise-multi-level-JSON-in-VB-NET. Didn't solve this issue, now. Googled and nothing matches this circumstance.
推荐答案
这篇关于JSON反序列化问题:VB.NET中的列表(项目)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!