Help parsing a nested JSON object

前端 未结 3 1195
别那么骄傲
别那么骄傲 2021-01-06 17:01

I have the following JSON:

{
    \"meta\": {
        \"code\": 200
    }, 
    \"response\": {
        \"deals\": [
            {
                   


        
3条回答
  •  心在旅途
    2021-01-06 17:31

    You could try changing your code to something like this:

    NSDictionary *primaryLocation =  [[[deal valueForKey:@"business"] valueForKey:@"locations"] objectAtIndex:0];
    NSLog(@"Address: %@", [primaryLocation valueForKey:@"address"]);
    NSLog(@"City: %@", [primaryLocation valueForKey:@"locality"]);
    NSLog(@"Phone: %@", [primaryLocation valueForKey:@"phone"]);
    

提交回复
热议问题