I have this JSON tree and I need to group the arrays by category key. (In this example,: "","1","2","3" and "serf" are value names for categories.) I'm serializing JSON using NSJSONSerialization but can't parse it the way I want to. Here is some of my code:
NSData *data2=[NSData dataWithContentsOfURL:url2];
result2=[NSJSONSerialization JSONObjectWithData: data2
options: NSJSONReadingMutableContainers
error: nil];
NSLog(@"button data: %@", result2);
for (NSDictionary *strh in [result2 objectForKey:@"template"]) {
//the json struct above is called result2 here
//now i need to parse any category with their names..
}
Related: Here is my question about how to create multidimentional arrays with key-value matching in PHP.