Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spaces improperly removed from object keys #19

Open
GoogleCodeExporter opened this issue Jun 12, 2015 · 0 comments
Open

Spaces improperly removed from object keys #19

GoogleCodeExporter opened this issue Jun 12, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. use an object key containing a space e.g. "{ ""key with 3 spaces"": 1 }"
2. parse the json
3. key no longer has spaces

What is the expected output? What do you see instead?
JSON object keys should be allowed to have spaces. 

What version of the product are you using? On what operating system?
mac 2011 excel

Please provide any additional information below.

Here is an easy test to illustrate the problem:
1. change the parseKey() func to public
2. run the following test:
Public Sub test()
    Dim s As String, k As String
    Dim j As json
    Set j = New json
    s = """key with spaces"":{""etc..."""
    k = j.parseKey(s, 1)
    Debug.Print "value '" & k & "' should have spaces but does not"
End Sub

This is easily fixed by replacing the parseKey() line below:
            If InStr(vbCrLf & vbCr & vbLf & vbTab & " ", Char) Then
with
            If dquote Or squote Then
                parseKey = parseKey & Char
            ElseIf InStr(vbCrLf & vbCr & vbLf & vbTab & " ", Char) Then

Original issue reported on code.google.com by [email protected] on 15 Aug 2014 at 10:31

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant