Ich beschäftige mich jetzt schon seit mehreren Tagen mit der Json API von Newtonsoft und Ich werde allmählich verrückt.
Ich möchte dieses mehrdimensionale Array parsen
Ich hatte zuerst das Problem das "19346232" dynamisch ist. Durch etwas einlesen und Beispielen konnte ich das umsetzen.
Mein Problem ist es jetzt das Array "entries" anzusprechen.
Ich hab das ganze mal soweit versucht aber Ich komme leider nicht mehr weiter.
Fehlermeldung
Ich möchte dieses mehrdimensionale Array parsen
Quellcode
- {
- "19346232": [
- {
- "name": "Master Yi's Pyromancers",
- "tier": "GOLD",
- "queue": "RANKED_SOLO_5x5",
- "entries": [
- {
- "playerOrTeamId": "19346232",
- "playerOrTeamName": "Wamborambo",
- "division": "V",
- "leaguePoints": 58,
- "wins": 109,
- "losses": 104,
- "isHotStreak": false,
- "isVeteran": false,
- "isFreshBlood": false,
- "isInactive": false
- }
- ]
- },
- {
- "name": "Elise's Masterminds",
- "tier": "BRONZE",
- "queue": "RANKED_TEAM_3x3",
- "entries": [
- {
- "playerOrTeamId": "TEAM-4f457680-9f2b-11e4-8954-c81f66db8bc5",
- "playerOrTeamName": "KidGalahad",
- "division": "IV",
- "leaguePoints": 63,
- "wins": 6,
- "losses": 8,
- "isHotStreak": false,
- "isVeteran": false,
- "isFreshBlood": false,
- "isInactive": false
- }
- ]
- },
- {
- "name": "Elise's Horde",
- "tier": "BRONZE",
- "queue": "RANKED_TEAM_5x5",
- "entries": [
- {
- "playerOrTeamId": "TEAM-4f457680-9f2b-11e4-8954-c81f66db8bc5",
- "playerOrTeamName": "KidGalahad",
- "division": "I",
- "leaguePoints": 28,
- "wins": 6,
- "losses": 4,
- "isHotStreak": false,
- "isVeteran": false,
- "isFreshBlood": false,
- "isInactive": false
- }
- ]
- }
- ]
- }
Ich hatte zuerst das Problem das "19346232" dynamisch ist. Durch etwas einlesen und Beispielen konnte ich das umsetzen.
VB.NET-Quellcode
- Dim jsonSource As String = reader.ReadToEnd
- Dim dynamicObj = Newtonsoft.Json.JsonConvert.DeserializeObject(Of JObject)(jsonSource)
- For Each prop As JProperty In dynamicObj.Properties()
- For Each subObj As JObject In prop.Values(0)
- liganameSolo = subObj("name") '5vs5 Division Name
- rangSolo = subObj("tier")
- Next
- Next
Mein Problem ist es jetzt das Array "entries" anzusprechen.
Ich hab das ganze mal soweit versucht aber Ich komme leider nicht mehr weiter.
Fehlermeldung
Accessed JArray values with invalid key value: "wins". Array position index expected.