Json array value vba access

Code examples

0
0

Public Sub test()
    Dim s As String
    s = "{""Earth"":{""Fruits"":[{""name"":""Mango""},{""name"":""Apple""},{""name"":""Banana""}]}}"
    PrintMatches s
End Sub
Public Sub PrintMatches(ByVal s As String)
    Dim i As Long, matches As Object, re As Object
    Set re = CreateObject("VBScript.RegExp")
    With re
        .Global = True
        .MultiLine = True
        .IgnoreCase = False
        .Pattern = """name"":""(.*?)"""
        If .test(s) Then
            Set matches = .Execute(s)
            For i = 0 To matches.Count - 1
                Debug.Print matches(i).SubMatches(0)
            Next i
        Else
            Debug.Print "No matches"
        End If
    End With
End Sub

Similar pages

Similar pages with examples

In other languages

This page is in other languages

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................
Балгарскі
..................................................................................................................
Íslensk
..................................................................................................................