iOS Question Parse Json with CRLF

Humberto

Active Member
Licensed User
Longtime User
I´m trying to convert json into list but when the text contain CRLF I get an error
I try the same in B4A and works ok

B4X:
Sub Button2_Click
    Dim xTemp As String
    xTemp = "[{""text:"" : ""Text without line feed and control return "" }]"
    test ( xTemp)
 
End Sub

Sub Button1_Click
    Dim xTemp As String
 
    xTemp = "[{""text:"" : ""Text with " & CRLF & "line feed and control return "" }]"
    test ( xTemp)
End Sub

Sub test ( pText As String )
    Dim json As JSONParser
    Dim xList As List
 
    Try
        json.Initialize(pText)
        xList = json.NextArray
        Label1.Text = "Json OK"  
    Catch
        Log(LastException)
        Label1.Text = "Error" 
    End Try
 
End Sub


I don´t know why
 

Attachments

  • json_zip.zip
    2.3 KB · Views: 204

Humberto

Active Member
Licensed User
Longtime User
Thanks Erel works

In the small project works ok, but in the original project I had to do this to work

B4X:
        pResp = pResp.Replace(Chr(13), "" )
        pResp = pResp.Replace(Chr(10), "\n" )

In B4A I don´t have to do this, works with CRLF in the text
 
Upvote 0
Top