-1

I have used SBJsonParser and ASIFormDataRequest for Posting and JSON Parsing, like

NSString *urlStr = @"http:facebookpage/second/index.php";
NSURL *log_Url = [NSURL URLWithString:urlStr];

request = [ASIFormDataRequest requestWithURL:log_Url];
[ASIHTTPRequest setSessionCookies:nil];
[request setPostValue:uName.text forKey:@"uname"];
[request setPostValue:passWord.text forKey:@"pwd"];
[request setPostValue:@"login" forKey:@"req"];
[request startSynchronous];

NSError *error = [request error];
if (!error) {
    response = [request responseString];
}
NSLog(@"%@",response);

Then For Parsing:

parser = [[SBJsonParser alloc]init ];
json_dic_values = [parser objectWithString:response error:nil];
NSString *status = [json_dic_values objectForKey:@"status"];
Url_pathforPages = [json_dic_values objectForKey:@"url"];
NSString *sessionID = [json_dic_values objectForKey:@"session_id"];

Here I need to know how can i do this same in NSJsonSerialization. Everything is working fine in above method....

Harish
  • 2,496
  • 4
  • 24
  • 48
  • Have you read the documentation of the `NSJSONSerializationClass`? It doesn't seem so... –  May 30 '13 at 14:21

1 Answers1

0

There are really only a few methods in NSJSONSerialization. Take a look at the documentation.

json_dic_values = [NSJSONSerialization JSONObjectWithData: [response dataUsingEncoding: NSUTF8StringEncoding] options: 0 error: &error];
maroux
  • 3,764
  • 3
  • 23
  • 32