when i try to parse the response returned from a web service i got this stack:
JSONValue failed. Error trace is: (
"Error Domain=org.brautaset.JSON.ErrorDomain Code=3 \"Unrecognised leading character\" UserInfo=0x6e76c30 {NSLocalizedDescription=Unrecognised leading character}"
)
My code is like this:
if(request.responseStatusCode==200)
{
NSLog(@"so far, this block of code works");//this log is displayed
//parse the response
NSArray *array=[[request responseString]JSONValue];
//processing the array and do whatever
In this thread they talking about an old version of the JSON library and how to update it, please help me figure out what should i do.
EDIT:
when trying to parse the response, i wanted to see why the server return, so an NSLog like so:
if(request.responseStatusCode==200)
{
NSLog(@"the request is %@", request.responseString);
//parse the response
NSArray *array=[[request responseString]JSONValue];
//processing the array and do whatever
give me this stack:
the request is <br />
<b>Warning</b>: implode() [<a href='function.implode'>function.implode</a>]: Invalid arguments passed in <b>/homepages/25/xxxx/htdocs/my app/webservices/index.php</b> on line <b>39</b><br />
<br />
<b>Fatal error</b>: Call to undefined function sendResponse() in <b>/homepages/25/xxxxx/htdocs/my app/webservices/index.php</b> on line <b>57</b><br />
2012-01-20 15:10:45.491 my-iPhone-application[882:11603] -JSONValue failed. Error trace is: (
"Error Domain=org.brautaset.JSON.ErrorDomain Code=3 \"Unrecognised leading character\" UserInfo=0x6ebd450 {NSLocalizedDescription=Unrecognised leading character}"
)
EDIT 2:
My application sent an array that is supposed to be received and processed in the web services. So one example of how the array received looks like is:
(
Mairie,
\"Pr\\U00e9fectures et sous-pr\\U00e9fectures\",
\"Auto-\\U00e9cole\"
)
The strange ant-slashes and 00 are the é caracter. Am i wrong to use them in my data? Is this which is causing my problem?
The error pretty much says it all, the parser does not consider the JSON string is it reading to be valid JSON. “Unrecognised leading character” means that it found something other than a
{or[character as the first character in the string returned from[request responseString]If you post the raw JSON we might be able to help you point out exactly what is wrong with the response.
HTH