Get nested data from local JSON file

Posted by Lbase on Stack Overflow See other posts from Stack Overflow or by Lbase
Published on 2014-08-24T03:49:04Z Indexed on 2014/08/24 4:20 UTC
Read the original article Hit count: 123

Filed under:
|
|

Now that I have the NSDictionary object JSONDictionary, how do I get the nested data inside of it?

    NSString *JSONFilePath = [[NSBundle mainBundle] pathForResource:@"sAPI" ofType:@"json"];
    NSData *JSONData = [NSData dataWithContentsOfFile:JSONFilePath];
    NSDictionary *JSONDictionary = [NSJSONSerialization JSONObjectWithData:JSONData options:kNilOptions error:nil];
    NSLog(@"Dictionary: %@", JSONDictionary);

sAPI.json snippet:

{
    "ss": [{
               "name": "bl",
               },
               "ls": [{
                           "name": "ML",
                           "abbreviation": "ml",
                           "id": 10,

© Stack Overflow or respective owner

Related posts about ios

Related posts about objective-c