Ios 如何解析对象内部的JSON字典

Ios 如何解析对象内部的JSON字典,ios,objective-c,json,uitableview,afnetworking,Ios,Objective C,Json,Uitableview,Afnetworking,我得到了以下JSON对象。我需要获取时间表并在表视图中显示值,将其转换为用户本地时区。我可以转换时间,但是对于如何检索schedule对象并在UITableView中显示开始和结束日期,我有点困惑。我将非常感谢这里的任何帮助。谢谢:) 假设您列出的一大块JSON被下载并存储在名为jsonData的NSData变量中 NSDictionary *json = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:nil;

我得到了以下JSON对象。我需要获取时间表并在表视图中显示值,将其转换为用户本地时区。我可以转换时间,但是对于如何检索schedule对象并在UITableView中显示开始和结束日期,我有点困惑。我将非常感谢这里的任何帮助。谢谢:)


假设您列出的一大块JSON被下载并存储在名为
jsonData
NSData
变量中

NSDictionary *json = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:nil; // use an NSError if you want
NSArray *scheduleDates = json[@"schedule"];
for (NSDictionary *dates in scheduleDates) {
    NSString *endDateString = dates[@"end_date"];
    NSString *startDateString = dates[@"start_date"];
}
这是一种可以访问计划对象中的计划和日期的方法。由你决定如何处理这些信息。而且,这是一种快速获取信息的肮脏方式。通过将JSON映射到对象,应该有一些nil检查/类型安全/内省

NSDictionary *json = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:nil; // use an NSError if you want
NSArray *scheduleDates = json[@"schedule"];
for (NSDictionary *dates in scheduleDates) {
    NSString *endDateString = dates[@"end_date"];
    NSString *startDateString = dates[@"start_date"];
}