Dim url As String = "https://ekb.tvstart.ru/app/static/ekb_team1.json"
Dim json As String = ""

' Чтение URL
Try
Dim wc As New System.Net.WebClient
wc.Encoding = System.Text.Encoding.UTF8
json = wc.DownloadString(url)
Catch ex As Exception
Console.WriteLine("Ошибка загрузки JSON: " & ex.Message)
Return
End Try

' --- Парсинг первых 12 num + NameGFX ---
Dim nums(11) As String
Dim names(11) As String
Dim count As Integer = 0
Dim pos As Integer = 0

While count < 12
    ' ищем "num"
    Dim k As Integer = json.IndexOf("""num""", pos)
    If k = -1 Then Exit While

        Dim c As Integer = json.IndexOf(":", k)
        If c = -1 Then Exit While

            Dim j As Integer = c + 1
            While j < json.Length AndAlso Char.IsWhiteSpace(json(j))
                j += 1
                End While

                Dim numVal As String = ""
                If j < json.Length AndAlso json(j) = """"c Then
                    j += 1
                    Dim startQ As Integer = j
                    While j < json.Length AndAlso json(j) <> """"c
                        j += 1
                        End While
                        numVal = json.Substring(startQ, j - startQ)
                        j += 1
                    Else
                        Dim startN As Integer = j
                        While j < json.Length AndAlso (Char.IsDigit(json(j)) OrElse json(j) = "-"c OrElse json(j) = "."c)
                            j += 1
                            End While
                            numVal = json.Substring(startN, j - startN)
                        End If

                        ' ищем "NameGFX"
                        pos = j
                        Dim kn As Integer = json.IndexOf("""NameGFX""", pos)
                        If kn = -1 Then Exit While

                            Dim cn As Integer = json.IndexOf(":", kn)
                            If cn = -1 Then Exit While

                                Dim jn As Integer = cn + 1
                                While jn < json.Length AndAlso Char.IsWhiteSpace(json(jn))
                                    jn += 1
                                    End While

                                    Dim nameVal As String = ""
                                    If jn < json.Length AndAlso json(jn) = """"c Then
                                        jn += 1
                                        Dim startGN As Integer = jn
                                        While jn < json.Length AndAlso json(jn) <> """"c
                                            jn += 1
                                            End While
                                            nameVal = json.Substring(startGN, jn - startGN)
                                            jn += 1
                                        End If

                                        nums(count) = numVal
                                        names(count) = nameVal
                                        count += 1

                                        pos = jn
                                        End While

                                        ' --- Выводим результат ---
                                        Console.WriteLine("=== Первые " & count.ToString() & " игроков ===")
                                        For i As Integer = 0 To count - 1
                                            Console.WriteLine(nums(i) & "_" & names(i))
                                            Next

                                            ' --- Выводим результат ---
                                            Console.WriteLine("=== Первые " & count.ToString() & " игроков ===")
                                            For i As Integer = 0 To count - 1
                                                Console.WriteLine(nums(i) & "_" & names(i))

                                                ' === Отправляем в титр TeamRoster.gtzip ===
                                                ' Номер
                                                API.Function("SetText", Input:="TeamRoster.gtzip", SelectedName:="PlayerNamber" & (i + 1).ToString() & ".Text", Value:=nums(i))
                                                ' Имя
                                                API.Function("SetText", Input:="TeamRoster.gtzip", SelectedName:="PlayerName" & (i + 1).ToString() & ".Text", Value:=names(i))
                                                Next