I am trying to get an exchange rate from the iGoogle Calculator. I have successfully run a NSURLConnection and built up the result in an NSData via:
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
// Add the data to our complete response
[urlResponse appendData:data];
}
I am now parsing the JSON returned by google in:
- (void)connectionDidFinishLoading:(NSURLConnection *)connection
{
NSString *dataString =[[NSString alloc]initWithData:urlResponse encoding:NSUTF8StringEncoding];
// log out the result
NSLog(@" Result %@", dataString );
NSDictionary *dic = [dataString JSONValue];
NSLog(@" Dic %@", dic );
I am using the SBJSON category on NSString to to parse the JSON. My log output is below:
URL: http://www.google.com/ig/calculator?hl=en&q=1USD=?CRC
Result {lhs: "1 U.S. dollar",rhs: "501.756147 Costa Rican colones",error: "",icc: true}
-JSONValue failed. Error is: Illegal start of token [l]
I simply cannot see what is wrong with the JSON string. None of the other answers around this reflect the problem I am having.