vb.net - 如何正确解析这个 JSON 字符串
问题描述
我有一些返回以下 JASON 的 API,我试图解析它以便能够从我想要的任何属性中提取。
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
解决方案
推荐阅读
- python - 安装 tensorflow(AVX 支持)和 cpuid python 时出错
- django - 在 Django REST 框架中,如何告诉我的序列化程序更新成员字段,而不是尝试从头开始创建它?
- javascript - nodejs上的fetch api问题
- javascript - 如何使用 Javascript 获取多个对象数组的每种组合
- python - How to check if tuple key contains an element in dictionary
- sql-server - 如何解决连接到 SQL Server 的错误
- kubernetes - 如何在 Kubernetes 中挂载单个非配置文件?
- react-native - 验证 app.json 的问题:无法执行缓存刷新
- c# - Unity的C#中如何通过右键切换显示/不显示
- windows - Clang 8.0.1 总是在 Windows 上创建控制台应用程序