[Solved] How to Parse an Array of Strings (JSON) – iOS?


use the following custom method

-(NSArray *)stringArrayFromJsonFile:(NSString *)jsonFileName withKey:(NSString *)key
{
    NSData *fileContents = [NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:jsonFileName ofType:@"json"]];
    NSError *error;

    NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:fileContents options:kNilOptions error:&error];

    NSArray * stringArray = [dict objectForKey:key];

    return stringArray;
}

now call that method like

NSArray* stringArray =  [self stringArrayFromJsonFile:@"yourJsonFileName" withKey:@"categories"];

1

solved How to Parse an Array of Strings (JSON) – iOS?