我是 iOS 新手,我正在尝试解析 JSON 数据。枚举内部不会记录任何内容,尽管 vehicleActivity 记录“车辆(空)。我有兴趣记录“LineRef”数据。我假设它在 NSString 中,但我尝试使用 id 对象但仍然没有。
NSDictionary *jsonParse = [NSJSONSerialization JSONObjectWithData:webData options:0 error:nil];
NSArray * vehicleActivity = [jsonParse objectForKey:@"VechicleActivity"];
NSLog(@"vehicle %@",vehicleActivity);
for (NSDictionary *dictionary in vehicleActivity ) {
NSDictionary *monitoredVehJourney = [dictionary objectForKey:@"MonitoredVehicleJourney"];
NSString *line = [monitoredVehJourney objectForKey:@"LineRef"];
NSLog(@"Line # %@",line);
谢谢