title: Iphone Http request response using json
body: <p>I am trying to send the data to server and get the response. Data is reaching server but I am not getting any response. The value of response data is nil bcd of which it's throwing an exception,</p>
  
  <pre><code>-JSONValue failed. Error trace is: (
  "Error Domain=org.brautaset.JSON.ErrorDomain Code=11 \"Unexpected end of string\" UserInfo=0x4e2dd70 {NSLocalizedDescription=Unexpected end of string}"
  </code></pre>
  
  <p>Can anyone pls help me....</p>
  
  <p><strong>My code:</strong></p>
  
  <pre><code>NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://192.168.0.83:8082/WebServiceProject/AcessWebservice?operation=login"]];
  [[NSURLConnection alloc] initWithRequest:request delegate:self];
  
  NSURLResponse *theResponse =[[NSURLResponse alloc]init];
  NSError *theError = NULL;
  NSArray *keys = [NSArray arrayWithObjects:@"UserId", @"Password", nil];
  NSArray *objects = [NSArray arrayWithObjects:@"rajin.sasi", @"abhi1551", nil];
  NSDictionary *jsonDictionary = [NSDictionary dictionaryWithObjects:objects forKeys:keys];
  
  
  NSString* jsonString = [jsonDictionary JSONRepresentation];
  
  SBJSON *jsonParser = [SBJSON new];
  [jsonParser objectWithString:jsonString];
  
  NSLog(@"Val of json parse obj is %@",jsonString);   
  [request setHTTPMethod:@"POST"];
  
  [request setValue:jsonString forHTTPHeaderField:@"json"];
  responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&amp;theResponse error:&amp;theError];      
  [request setHTTPBody:responseData];
  
  NSMutableString* stringData= [[NSString alloc]initWithData:responseData encoding:NSUTF8StringEncoding];
  NSDictionary    *jsonDictionaryResponse = [stringData JSONValue];
  
  NSString *json_message=[jsonDictionaryResponse objectForKey:@"message"];
  
  printf("Json string is %s **********",[json_message UTF8String]);
  </code></pre>