1

我正在尝试解析 json 字符串。但我无法使用以下代码执行此操作,请帮助我。其他明智的显示任何替代代码来解析 json 字符串。
在代码中,我得到了 json 字符串。但我无法在任何字典中解析数组中的那个字符串。在这个方法的最后,我放了三个 nslog 语句,中间一个在解析时显示 nsarray 的空值。请帮助我或建议任何替代代码。

NSString *JsonString = [NSString stringWithFormat:@"http://bia.igreentechservices.com/ws/ws_registration.php?emailid=%@&password=%@&fname=%@&lname=%@&gender=%@&birthdate=%@&mobile=%@&address=%@&emergency_contact_no=%@&other_contact_no_1=%@&other_contact_no_2=%@",emailAdd,pwd,fName,lName,gen,bDate,mobileNum,add,emergencyContactNum,anotherContactNum1,anothercontactNum2];


-(void)callWebService:(NSString *)JsonString {

SBJsonParser *parser = [[SBJsonParser alloc] init];
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:JsonString]];
NSData *response = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];
NSString *Json_string = [[NSString  alloc] initWithData:response encoding:NSUTF8StringEncoding];
registrationDetail = [parser objectWithString:Json_string error:nil];
for(NSDictionary *status in registrationDetail) {
    NSLog(@"%@ ", [status objectForKey:@"registration"]);// here, this output does not show any out put in conlsole.
NSLog(@"%@",response);

NSLog(@"%@",registrationDetail); // here why this line is showing null  as output in console 
NSLog(@"%@",Json_string);
}
4

0 回答 0