简体   繁体   中英

Parsing JSon Data FlightAware

I am using the flight aware service to get flight information but I am having trouble getting the data in a way I can use.

Json response is:

{
    "AirlineInfoResult": {
        "name": "US Airways",
        "shortname": "US Airways",
        "callsign": "Cactus",
        "location": "Tempe, AZ",
        "country": "United States",
        "url": "http://www.usairways.com/",
        "phone": "+1-800-428-4322"
    }
}    

And this is the code I am using but nothing is returned

NSMutableDictionary * routeRes;
routeRes = [json objectForKey: @"AirlineInfoResult"];
NSMutableArray * res;
res = [json objectForKey: @"url"];
for (NSMutableDictionary * flight in res) {
    NSLog(@"actual arrival time= %@", [flight objectForKey: @"url"]);
}   

What am I missing in getting this data?

change below line:

res = [json objectForKey:@"url"];

with

res = [routeRes objectForKey:@"url"];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM