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"]);
                                           }

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM