iOS 字典转数组

 

    NSDictionary *returnDictionary = notification.userInfo;

    NSLog(@"llllllllllllllllloooooooooooo:%@",returnDictionary);

    NSMutableArray *gg=returnDictionary[@"musiclistsss"];

 

为了更加方便的从多重字典里嵌套数组在这里记录下解套的方法,就可以按嵌套的多少慢慢解了!

数组里面嵌套了字典,如图

 

你就这样

NSMutableArray *gg=dict;//把字典转成可变数组
//      NSLog(@"%@",gg[0]);
        NSDictionary *dict1=gg[0];//读取数组后再转回字典
        NSLog(@"%@",dict1[@"country"]);
 for (int i=0; i<gg.count; i++) {
                                               NSDictionary *dict3=[gg objectAtIndex:i];
                                               NSLog(@"%@",dict3[@"country"]);
                                           }

 

 

posted on 2018-09-07 15:46  高彰  阅读(2514)  评论(0编辑  收藏  举报

导航