There are too many magic numbers in this code, but here you go:
// Build an Array of keys @[@"item_1_type_1", @"item_1_type_2", ..., @"item_1_type_9"] programmatically
const int numberOfElements = 9;
NSMutableArray *keys = [NSMutableArray arrayWithCapacity:numberOfElements];
for (int i = 1; i <= numberOfElements; i++) {
[keys addObject:[NSString stringWithFormat:@"item_1_type_%d", i]];
}
// Extract chosen keys from JSON Dictionary into an Array, matching the
// order of the keys above.
NSDictionary *subDict = myJSONData[@"item1"];
NSArray *myArray = [subDict objectsForKeys:keys notFoundMarker:[NSNull null]];
1
solved Auto increasing numbers in array