Hi I am currently modifying an Android App to work on IOS and I am retrieving data from a database and parsing it using the following code
I have tried Dim R As Map = parser.NextArray as well but both fail with the following
Error parsing string: Error Domain=NSCocoaErrorDomain Code=3840 "Garbage at end around line 1, column 68." UserInfo={NSDebugDescription=Garbage at end around line 1, column 68., NSJSONSerializationErrorIndex=68}
The code in B4A works perfectly therefore I am not seeing where it is going wrong as the JSON string I get back from the database is what I would expect
Below is the JSON string
[{"ID":4,"Usertype":"Admin","UserCompanyName":"A R Stacey and Son"}]<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><CheckCredentialsResponse xmlns="http://tempuri.org/" />
Could somebody tell me where I am going wrong?
Regards
David
Parsing:
Dim parser As JSONParser
Dim response As String = job.GetString
Log(response)
parser.Initialize(response)
Dim R As Map = parser.NextObject
For Each colroot As Map In R
Main.Usertype = colroot.Get("Usertype")
Main.UserID = colroot.Get("ID")
Main.UserCompanyName = colroot.Get("CompanyName")
Main.CompanyName = colroot.Get("CompanyName")
Main.UserCompanyType = colroot.Get("CompanyType")
Next
I have tried Dim R As Map = parser.NextArray as well but both fail with the following
Error parsing string: Error Domain=NSCocoaErrorDomain Code=3840 "Garbage at end around line 1, column 68." UserInfo={NSDebugDescription=Garbage at end around line 1, column 68., NSJSONSerializationErrorIndex=68}
The code in B4A works perfectly therefore I am not seeing where it is going wrong as the JSON string I get back from the database is what I would expect
Below is the JSON string
[{"ID":4,"Usertype":"Admin","UserCompanyName":"A R Stacey and Son"}]<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><CheckCredentialsResponse xmlns="http://tempuri.org/" />
Could somebody tell me where I am going wrong?
Regards
David