i am new to JSON Parsing. I am using SBJson 3.1 and trying to fetch data in response to which I got above error. I have searched alot on Google, but no one has ever asked or explained what actually error Illegal Start of Token
means. So please can somebody explain me this? And how can I debug this error?
The code I have written so far is:
-(IBAction) Start:(id)sender
{
responseData = [[NSMutableData data] retain];
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:URL]];
[[NSURLConnection alloc] initWithRequest:request delegate:self];
}
-(void) connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
{
[responseData setLength:0];
}
-(void) connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
[responseData appendData:data];
}
-(void) connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
{
label.text = [NSString stringWithFormat:@"Connection failed: %@", [error description]];
[connection release];
responseData = nil;
}
-(void) connectionDidFinishLoading:(NSURLConnection *)connection
{
[connection release];
NSString *responseString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
[responseData release];
NSDictionary *dict = [responseString JSONValue];
}