VBA-tools / VBA-JSON

JSON conversion and parsing for VBA
MIT License
1.81k stars 577 forks source link

Multiline value parsing issue #268

Open igu-ru opened 7 months ago

igu-ru commented 7 months ago

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
...