Results 1 to 6 of 6

Thread: VB6 JSON Parser

Threaded View

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 2006
    Location
    Craiova, Romania
    Posts
    140

    VB6 JSON Parser

    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...
    Last edited by cliv; Jan 29th, 2014 at 07:26 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width