I have a dictionary called array:
{
"encoding": "320",
"format": "MP3",
"media": "CD",
"name": "foo",
"remaster_title": ""
},
{
"encoding": "V0 (VBR)",
"format": "MP3",
"media": "CD",
"name": "bar",
"remaster_title": ""
},
{
"encoding": "Lossless",
"format": "FLAC",
"media": "CD",
"name": "bar",
"remaster_title": "hoho"
}
I want to separate these so that they are unique. For example there should only be one name so there will be two sections: foo and bar.
Then within each name (foo or bar) there should be the remaster_title (for foo: and bar both: and hoho)....
This should be in the order: name > remaster_title > media > format > encoding.
I think this would work if I could have a format similar to:
music[name][remaster_title][media][format] = encoding
so all the keys would then merge?
I have tried:
+(NSMutableDictionary*)handleReturnedArtistJson:(NSDictionary*)json{
NSMutableDictionary *music = [[NSMutableDictionary alloc] init];
for(NSDictionary *result in json[@"response"][@"group"]) {
NSString* release_type = result[@"releaseType"];
NSString* name = result[@"groupName"];
if (![release_type isEqual: @"Compilation"]){
for (NSDictionary *subgroup in result[@"subgroup"]){
NSString* media = subgroup[@"media"];
NSString* remaster_title = subgroup[@"remasterTitle"];
NSString* format = subgroup[@"format"];
NSString* encoding = subgroup[@"encoding"];
music[name][remaster_title][media][format] = encoding;
}
}
}
return music;
}
but NSLog(@"%@",music); returns nothing.
{name:{remastered_title1:{"encoding":...,"format":...,"media":...}, remasted_title2:{...}}, name2:...}?