Q:

Json Data in int format

I am parsing json and the url is returning an integer value. (e.g. 278)
-(void) connectionDidFinishLoading: (NSURLConnection *) connection{
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
NSString *responseString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
NSLog(@"JSON Response = %@",responseString);}

when I am printing response in NSLog, it gives out something like this
2012-09-15 18:02:02.091 Web Service[5190:f803] JSON Response = "278"
I don't want the output in quotes. I want it like
2012-09-15 18:02:02.091 Web Service[5190:f803] JSON Response = 278
how can i achieve this?
JSON
NSString *urlString = [NSString stringWithFormat:@"http://10.5.6.105/ARAPPWS/Service1/InsertEmp/name=%@,phone=%@",name.text,number.text];
    NSURL *addUrl = [NSURL URLWithString:urlString]; 
    NSURLRequest *addRequest = [NSURLRequest requestWithURL:addUrl];
    (void)[NSURLConnection connectionWithRequest:addRequest delegate:self];

-(void) connection: (NSURLConnection *) connection didReceiveResponse:(NSURLResponse *)response
{
jsonData = [[NSMutableData alloc]init];

}
-(void) connection: (NSURLConnection *) connection didReceiveData:(NSData *)data
{
[jsonData appendData:data];

}

-(void) connectionDidFinishLoading: (NSURLConnection *) connection
{
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
responseString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];

[self performSelector:@selector(uploadEmpImg:) withObject:nil afterDelay:1];
}

Thanks in advance.

A:

You can use - [NSString integerValue] to obtain the actual numerical representation of the string:
NSLog(@"JSON response = %d", [responseString integerValue]);

Edit: the problem is that it returns a JSON fragment - strictly speaking it's not valid JSON. You can then use
[responseString substringWithRange:NSMakeRange(1, responseString.length - 2)]

to get the actual string value without the quotes and
[[responseString substringWithRange:NSMakeRange(1, responseString.length - 2)] intValue]

to get it as an integer.

