Parse json with NSJSONSerialization class using objectForKey in iOS
===

I am new in iOS development. I use this code to connect to my REST Web Service and fetch data in Json format. 
        
        NSString *url=@"http://192.168.1.100:8080/timelog/deliverable/project_id/user_id/get/1/rle/";
        
        NSURLRequest *theRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:url]];
        
        NSURLResponse *resp = nil;
        NSError *err = nil;
        
        NSData *response = [NSURLConnection sendSynchronousRequest: theRequest returningResponse: &resp error: &err];
        
    //    NSString * theString = [[NSString alloc] initWithData:response encoding:NSUTF8StringEncoding]; 
    //    NSLog(@"response: %@", theString);
        
        NSArray *jsonArray = [NSJSONSerialization JSONObjectWithData: response options: NSJSONReadingMutableContainers error: &err];
        
        if (!jsonArray) {
            NSLog(@"Error parsing JSON: %@", err);
        } else {
            for(NSDictionary *item in jsonArray) {
                NSLog(@" %@", item);
                NSLog(@"---------------------------------");
            }
        }

It prints the JSON String like : 

    2012-07-31 12:35:32.210 LearningAFNetworking[361:f803]  (
            {
            description = "Other related work";
            id = 275;
            key = "2.0";
            name = Other;
            parent =         {
                description = "";
                id = 4;
                key = 2;
                name = "Tasks 2 - Implementation of State Machines";
                parent = "<null>";
                project =             {
                    category =                 {
                        description = "";
                        id = 1;
                        name = "Unified Process";
                    };
                    description = "Project for Anders Garbenstedt from Transplain AB. Developing Canvoy system.";
                    id = 1;
                    key = tp;
                    name = Transplain;
                    "task_id" = 0;
                };
                "task_id" = 0;
            };
            project =         {
                category =             {
                    description = "";
                    id = 1;
                    name = "Unified Process";
                };
                description = "Project for Anders Garbenstedt from Transplain AB. Developing Canvoy system.";
                id = 1;
                key = tp;
                name = Transplain;
                "task_id" = 0;
            };
            "task_id" = 0;
        },
            {
            activity =         {
                category =             {
                    description = "";
                    id = 4;
                    name = Implementation;
                };
                cost = 690;
                id = 7;
                key = ic;
                name = "Implement components";
            };
            deliverable =         {
                description = "Other related work";
                id = 275;
                key = "2.0";
                name = Other;
                parent =             {
                    description = "";
                    id = 4;
                    key = 2;
                    name = "Tasks 2 - Implementation of State Machines";
                    parent = "<null>";
                    project =                 {
                        category =                     {
                            description = "";
                            id = 1;
                            name = "Unified Process";
                        };
                        description = "Project for Anders Garbenstedt from Transplain AB. Developing Canvoy system.";
                        id = 1;
                        key = tp;
                        name = Transplain;
                        "task_id" = 0;
                    };
                    "task_id" = 0;
                };
                project =             {
                    category =                 {
                        description = "";
                        id = 1;
                        name = "Unified Process";
                    };
                    description = "Project for Anders Garbenstedt from Transplain AB. Developing Canvoy system.";
                    id = 1;
                    key = tp;
                    name = Transplain;
                    "task_id" = 0;
                };
                "task_id" = 0;
            };
            description = "Fix bug with multiple results due to db error, new release 1.3.9.3 (Do not charge))";
            end = 1280329200000;
            id = 646;
            link = "";
            project =         {
                category =             {
                    description = "";
                    id = 1;
                    name = "Unified Process";
                };
                description = "Project for Anders Garbenstedt from Transplain AB. Developing Canvoy system.";
                id = 1;
                key = tp;
                name = Transplain;
                "task_id" = 0;
            };
            start = 1280326500000;
            started = 0;
            user =         {
                id = 3;
                password = "$2a$10$Hc4NAbLRqUM8rMlgiklzyORckiB7EwM3hJzL7xYBGheKdVh2StTK2";
                username = rle;
            };
        }
    )
    ........

Now I want to seperate them via `objectForKey`. I used this code inside the loop :

    NSString *name = [item objectForKey:@"name"];

It does not work. I got this error:

    2012-07-31 12:48:38.426 LearningAFNetworking[390:f803] -[__NSArrayM objectForKey:]: unrecognized selector sent to instance 0x6844460
    2012-07-31 12:48:38.428 LearningAFNetworking[390:f803] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSArrayM objectForKey:]: unrecognized selector sent to instance 0x6844460'
    *** First throw call stack:
    (0x13c8022 0x1559cd6 0x13c9cbd 0x132eed0 0x132ecb2 0x2f40 0x2bf8 0xd9a1e 0x38401 0x38670 0x38836 0x3f72a 0x290b 0x10386 0x11274 0x20183 0x20c38 0x14634 0x12b2ef5 0x139c195 0x1300ff2 0x12ff8da 0x12fed84 0x12fec9b 0x10c65 0x12626 0x254d 0x24b5 0x1)
    terminate called throwing an exception(lldb)


can you help me? Also as you can see in the JSON string every Deliverable item belongs to a Project and the Project has a id or name. how can I get them in iOS using `objectForKey`?