Skip to content

json_ParseString handling of new line (\n) #270

Closed
@zgrose

Description

@zgrose

I believe the n case in json_ParseString should be changed to append a vbLf instead of a vbCrLf or there should be an option to override the default behavior (I copied the current code into this issue at the bottom).

I noticed this issue when assigning a value to a TextBox.

My JSON was (simplified): { "Prop" : "Foo \r\nBar" }

In the Immediate window this shows
Foo
Bar

But when I assign that value to a TextBox that is MultiLine=True and EnterKeyBehavior=True

Me.TextBox1.Value = jobject("Prop")

the form shows Foo Bar in the TextBox.

If I change the JSON text to be { "Prop" : "Foo \nBar" } it displays properly.
If I change your code from vbCrLf to vbLf it displays properly.

I believe this is also a "truer" conversion for \n

Current code from 4.1.1

            Case "n"
                json_BufferAppend json_buffer, vbCrLf, json_BufferPosition, json_BufferLength
                json_Index = json_Index + 1
            Case "r"
                json_BufferAppend json_buffer, vbCr, json_BufferPosition, json_BufferLength
                json_Index = json_Index + 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions