VBA-tools/VBA-JSON

Multiline value parsing issue

igu-ru opened this issue · 0 comments

If a JSON value contain multiple lines and looks like {"description": "A\r\nB"}, its value is expected to be parse to the string "A" & vbCr & vbLf & "B". In fact it converts to "A" & vbCr & vbCr & vbLf & "B" (doubled vbCr's).

To fix this, I suggest modify the json_ParseString function:

...
        Case json_Quote
            json_ParseString = json_BufferToString(json_Buffer, json_BufferPosition)
            json_ParseString = VBA.Replace(json_ParseString, VBA.vbCr & VBA.vbCr, VBA.vbCr) ' Fix \r\r\n -> \r\n
            json_Index = json_Index + 1
            Exit Function
...