IOS JSON格式转换

- (IBAction)checkUpdate:(id)sender {
    
    NSString *urlStr=@"http://www.dszpvip.com/index.php?ios/api";
    
    NSURL * url=[NSURL URLWithString:urlStr];
    NSURLRequest * request=[[NSURLRequest alloc]initWithURL:url];
    NSError * error=nil;
    NSData * data=[NSURLConnection sendSynchronousRequest:request returningResponse:nil error:&error];
    
   
    NSDictionary *json=[NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:&error];
    
    
   NSMutableArray * images= [json objectForKey:@"data"];
   // NSLog(@"images=%@",images);
    
    NSString *document=[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
    NSString *plistPath=[document stringByAppendingPathComponent:@"images.plist"];
    
    //NSString * text=@"我是岁";
    [images writeToFile:plistPath atomically:YES];
    NSLog(@"path=%@",plistPath);
 
}


你可能感兴趣的:(IOS JSON格式转换)