如何正确解析此JSON字符串

时间:2019-03-26 17:34:09

标签: vb.net

我有一些API会返回以下JASON,我正在尝试解析它以便能够从我想要的任何属性中提取。

JSON正在尝试解析:https://pastebin.com/i06GRD0f

我假设正确的方法是将所有内容加载到数组中,但是我无法使其正常工作,因为它与所有不同的参数有些混淆。

Imports System.Web.Script.Serialization


Public Class ServerAttributes
    Public Property assists() As String
    Public Property bestRankPoint() As String
    Public Property boosts() As String
    Public Property dBNOs() As String
    Public Property dailyKills() As String
    Public Property dailyWins() As String

    Public Property damageDealt() As String
    Public Property days() As String
    Public Property headshotKills() As String
    Public Property heals() As String
    Public Property killPoints() As String
    Public Property kills() As String

    Public Property longestKill() As String
    Public Property longestTimeSurvived() As String
    Public Property losses() As String
    Public Property maxKillStreaks() As String
    Public Property mostSurvivalTime() As String
    Public Property rankPoints() As String

    Public Property rankPointsTitle() As String
    Public Property revives() As String
    Public Property rideDistance() As String
    Public Property roadKills() As String
    Public Property roundMostKills() As String
    Public Property roundsPlayed() As String

    Public Property suicides() As String
    Public Property swimDistance() As String
    Public Property teamKills() As String
    Public Property timeSurvived() As String
    Public Property top10s() As String
    Public Property vehicleDestroys() As String

    Public Property walkDistance() As String
    Public Property weaponsAcquired() As String
    Public Property weeklyKills() As String
    Public Property weeklyWins() As String
    Public Property winPoints() As String
    Public Property wins() As String
End Class

Public Class ServerData
    Public Property data() As ServerAttributes
End Class

Module StaterMainClass
    Public Sub GetInfo()
        Dim jss As New JavaScriptSerializer()
        Dim DataResponse As ServerData = jss.Deserialize(Of ServerData)(JSON)

        Debug.Print(DataResponse.data.assists(0))
   End Sub

End Module

0 个答案:

没有答案