Я пытаюсь разобрать ниже JSON, но я не получаю данные от этого JSON. В приведенном ниже JSON Я пытаюсь принести выбор, но его не получает с моим ниже кодомJSON Parsing of ios
NSString *filePathChoices = [[NSBundle mainBundle] pathForResource:@"questions" ofType:@"json"];
NSData *JSONDataChoices = [NSData dataWithContentsOfFile:filePathChoices options:NSDataReadingMappedIfSafe error:nil];
NSMutableDictionary *jsonObjectChoices = [NSJSONSerialization JSONObjectWithData:JSONDataChoices options:NSJSONReadingMutableContainers error:nil];
NSArray *arrayChoices = [jsonObjectChoices objectForKey:@"choices"];
//NSDictionary *jsonDict = [arrayChoices objectAtIndex:indexPath.row];
cell.textLabel.text = [arrayChoices objectAtIndex:indexPath.row];
Из этого ниже JSON я выборки выбора в Tableview
{
"questions": [
{
"question": "1. An ITM option has is priced at $3.00. The strike is at $20 and the underlying is trading at $19. What is the extrinsic value of the option?",
"choices": ["Ontario","New Brunswick","Manitoba","Quebec"],
"correctAnswer": 0
},
{
"question": "2. True or False. If a trader is long some calls and long some puts, he is likely to be?",
"choices": ["Ontario", "New Brunswick", "Nova Scotia", "Quebec"],
"correctAnswer": 3
},
{
"question": "3. Which of these provinces start with 'New'?",
"choices": ["Ontario", "New Brunswick", "Quebec", "Manitoba"],
"correctAnswer": 1
},
{
"question": "4. Which of these begin with the word 'Man'?",
"choices": ["Ontario", "New Brunswick", "Quebec", "Manitoba"],
"correctAnswer": 3
},
{
"question": "5. Which of these begin with the word 'Nova'?",
"choices": ["Ontario", "Nova Scotia", "British Columbia", "New Brunswick"],
"correctAnswer": 1
},
]
}
Это не массив. Перейдите на json.org и изучите синтаксис JSON. –
Недействительно JSON - Попробуйте jsonlint.com – Paulw11
проверить изменение .. –