Note that there are some explanatory texts on larger screens.

plurals
  1. POJSON parsing Error getting brautaset.JSON error
    primarykey
    data
    text
    <p>I am making a request to a server for some results that should be returned in <code>JSON</code> format.</p> <p>When I print out the requested string it shows correct the right output. However when I try to parse the result string i get the error:</p> <pre><code>Error Domain=org.brautaset.JSON.ErrorDomain Code=3 "Object value expected for key: result" UserInfo=0x6c4cbe0 {NSUnderlyingError=0x6c4caf0 "Object value expected for key: map", NSLocalizedDescription=Object value expected for key: result} </code></pre> <p>This is my code of JSON :</p> <pre><code>SBJSON *jsonParser = [[SBJSON alloc] init]; [jsonParser setHumanReadable:YES]; NSError *theError; NSString *loginPayload = @"{\"service\": \"getMyJobs\", \"params\": {\"map\": {\"day\": {\"javaClass\": \"java.sql.Timestamp\", \"time\": 1316757600000}}}, \"security\": {\"map\": {}}, \"userInfo\": false}"; NSURL * url = [NSURL URLWithString:kURLForAPI]; NSMutableURLRequest * req = [NSMutableURLRequest requestWithURL:url]; [req setHTTPMethod:@"POST"]; [req setHTTPBody:[loginPayload dataUsingEncoding:NSUTF8StringEncoding]]; [req setHTTPShouldHandleCookies:YES]; [req setValue:@"text/xml charset=UTF-8" forHTTPHeaderField:@"Content-Type"]; [req setValue:cookie forHTTPHeaderField:@"Cookie"]; NSHTTPURLResponse * response = nil; NSData * dataResult = [NSURLConnection sendSynchronousRequest:req returningResponse:&amp;response error:&amp;theError]; NSMutableDictionary *dicts; if (dataResult) { NSString *resultString = [[NSString alloc] initWithData:dataResult encoding:NSUTF8StringEncoding]; //NSLog(@"login response: %@",resultString); //NSLog(@"response %@", [response allHeaderFields]); dicts = [jsonParser objectWithString:resultString error:&amp;theError]; //dicts = [resultString JSONValue]; if(theError) { NSLog(@"Result %@",[theError description]); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload