Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21193

VB6 JSON Parser

$
0
0
I have json string like this:
Code:

{"0":"1","id":"1","1":"cliv","name":"cliv","2":"alecsandri","address":"alecsandri","3":"29-Jan-14 10:42:55 AM","datetime":"29-Jan-14 10:42:55 AM"}{"0":"2","id":"2","1":"dsad","name":"dsad","2":"adasdsa dadsa","address":"adasdsa dadsa","3":"29-Jan-14 10:45:03 AM","datetime":"29-Jan-14 10:45:03 AM"}{"0":"3","id":"3","1":"dada","name":"dada","2":"dasdadsa","address":"dasdadsa","3":"29-Jan-14 11:02:44 AM","datetime":"29-Jan-14 11:02:44 AM"}{"0":"4","id":"4","1":"dragcos","name":"dragcos","2":"craiova","address":"craiova","3":"29-Jan-14 11:28:44 AM","datetime":"29-Jan-14 11:28:44 AM"}{"0":"5","id":"5","1":"andrei","name":"andrei","2":"calea bucuresti","address":"calea bucuresti","3":"29-Jan-14 11:56:58 AM","datetime":"29-Jan-14 11:56:58 AM"}
And i use VB6 JSON Parser Class Library from here:
HTML Code:

http://www.ediy.co.nz/vbjson-json-parser-library-in-vb6-xidc55680.html
and this code to parse:
Code:

Private Sub decodeJSON(sData As String)
    Dim p As Object
    Set p = JSON.parse(sData)
   
    If Not (p Is Nothing) Then
        If JSON.GetParserErrors <> "" Then
            MsgBox JSON.GetParserErrors, vbInformation, "JSON Error"
        Else
            'MsgBox = p.Count
            MsgBox "OUT : " & JSON.toString(p)
            MsgBox p.Item("name")
        End If
    Else
        MsgBox "Parse Error"
    End If
End Sub

... but I read only only first row...
HOW CA I LOOP? (i want to load all record in a recordset...)
Thank you...

Viewing all articles
Browse latest Browse all 21193

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>