сохранить следующий ответ как файл sample.json
{
"Category": [
{
"name": "Mobile"
},
{
"name": "TV"
},
{
"name": "Computer"
},
{
"name": "Camera"
},
{
"name": "Home Appilances"
}
]
}
NSError *error = nil;
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"sample" ofType:@"json"];
NSData *myData = [NSData dataWithContentsOfFile:filePath];
NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:myData options:kNilOptions error:&error];
NSArray *catArray = [dict objectForKey:@"Category"];
for (int index = 0; index < catArray.count; index++) {
NSDictionary *valDic = [catArray objectAtIndex:index];
NSLog(@"%@", [valDic objectForKey:@"name"]);
}