我有一个Vb.net对象(下面)。它需要两个JSON请求才能完成该对象。一个请求给出标题和密钥,而另一个请求给我freeToPlay。如何使用这两个请求创建一个对象?
Public Class LeagueChampion
Inherits LeagueObject
'Public Property key As String
Public Property title As String
Public Property group As String
Public Property tags As String()
Public Property enemytips As String()
Public Property allytips As String()
Public Property blurb As String
Public Property rankedPlayEnabled As Boolean
Public Property botMmEnabled As Boolean
Public Property botEnabled As Boolean
Public Property active As Boolean
Public Property freeToPlay As Boolean
End Class
league_container = JsonConvert.DeserializeObject(Of LeagueChampionContainer)(rrm.returnFreeToPlayChampions("na"))
league_container = JsonConvert.DeserializeObject(Of LeagueChampionContainer)(rrm.returnLeagueChampions("na"))
答案 0 :(得分:0)
我建议你在DataContractJsonSerializer上使用JavaScriptSerializer。原因是:
JavaScriptSerializer比DataContractJsonSerializer更快。
对于简单的序列化,DataContractJsonSerializer需要比JavaScriptSerializer更多的代码。