ohmpreg / vba-json

Automatically exported from code.google.com/p/vba-json
0 stars 0 forks source link

parseKey with Key containing ":" #21

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. parse any JSON with a key containing a ":" (like in google analytics api 
answers)

What is the expected output? What do you see instead?
EXP: normal parsing
GOT: infinity loop

check code beginnning at  this case-statement:
https://code.google.com/p/vba-json/issues/attachmentText?id=15&aid=150001000&nam
e=jsonlib.cls&token#276

I added an else clause to solve this:
        Case ":"
            If Not dquote And Not squote Then
                index = index + 1
                Exit Do
            Else
                If InStr(vbCrLf & vbCr & vbLf & vbTab & " ", char) Then
                Else
                    parseKey = parseKey & char
                End If
                index = index + 1
            End If

(didn't test this in depth - just for my case)

Original issue reported on code.google.com by martin.w...@gmail.com on 30 Sep 2014 at 2:20