Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
JSON Optimization for Parsing Vainglory Telemetry Data
' Parses a JSON response and returns an Object
Public Function ParseJSON(data As String) As Object
' First split the string at the "PlayerFirstSpawn" action
Dim splitArray() As String
splitArray() = Split(data, "PlayerFirstSpawn")
' Get the position of the { character which would have been on the line of "PlayerFirstSpawn"
Dim splitTail As String
splitTail = InStrRev(splitArray(0), "{ ")
' Get all characters left of the broken line where "PlayersFirstSpawn" existed
Dim output As String
output = Left(splitArray(0), splitTail)
' Cleanup the final output by removing the remaining , { and then appending a closing JSON ]
Dim finalOutput As String
finalOutput = (Left(output, Len(output) - 3) & "]")
Set ParseJSON = JsonConverter.ParseJSON(finalOutput)
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.