iOS解析json

解析json网页文件

NSError *error;
NSURL *url=[NSURL URLWithString:@"http://10.191.255.121/web/picture/data/picture/littleredhat/config.json"];
NSString *jsonString = [NSString stringWithContentsOfURL:url encoding:NSUTF8StringEncoding error:&error];
NSData*jsonData=[jsonString dataUsingEncoding:NSUTF8StringEncoding];
NSDictionary *bookdic=[NSJSONSerialization JSONObjectWithData:jsonData options:0 error:nil];

你可能感兴趣的:(iOS解析json)