when i try parse the local json file it returns null value am using xcode6.2 beta and ios 8.1
I have followed this posts also How to read a JSON file using the NSJSONSerialization Class Reference?Cocoa-Touch - How parse local Json file2
My code is
NSString *jsonPath = [[NSBundle mainBundle] pathForResource:@"countries"
ofType:@"json"];
NSError *error = nil;
NSString *myJSON = [[NSString alloc] initWithContentsOfFile:jsonPath encoding:NSUTF8StringEncoding error:NULL];
id json = [NSJSONSerialization JSONObjectWithData:[myJSON dataUsingEncoding:NSUTF8StringEncoding]
options:NSJSONReadingMutableContainers
error:&error];
NSLog(@"JSON: %@", json);
//Upto myJson string value the json file converted into string but the jsonserialization only have //the problem and the response is always null.
//please give some suggestions,
//Thanks in advance,
my json file contains this values
{
"AD" = "Andorra";
"AE" = "United Arab Emirates";
"AF" = "Afghanistan";
"AG" = "Antigua and Barbuda";
"AI" = "Anguilla";
"AL" = "Albania";
"AM" = "Armenia";
}