JSON Parsing in iOS 7

前端 未结 14 2268
长情又很酷
长情又很酷 2020-12-04 11:25

I am creating an app for as existing website. They currently has the JSON in the following format :

[

   {
       \"id\": \"value\",
       \"array\": \"[{\         


        
14条回答
  •  心在旅途
    2020-12-04 12:15

     NSError *err;
        NSURL *url=[NSURL URLWithString:@"your url"];
        NSURLRequest *req=[NSURLRequest requestWithURL:url];
        NSData *data = [NSURLConnection sendSynchronousRequest:req returningResponse:nil error:&err];
        NSDictionary *json=[NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil];
        NSArray * serverData=[[NSArray alloc]init];
        serverData=[json valueForKeyPath:@"result"];
    

提交回复
热议问题