Display cell.textLabel.text from JSON response

I need to display the "href" web address as the cell.textlabel.text in a UITableView. Any help would be greatly appreciated.


"grandfathers": [{
        "id": "60",
        "sons": [{
            "id": "30",
            "grandsons": [{
                "id": "10",
                "links": {
                    "api": {
                        "news": {
                            "href": "http://api.website.com/v1/family/grandfathers/sons/grandsons/10/news"


@property (strong, nonatomic) NSArray *grandfathers;
@property (strong, nonatomic) NSMutableArray *sons;
@property (strong, nonatomic) NSArray *grandsons;

Table View:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    static NSString *CellIdentifier = @"standardCell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    Grandfather *grandfatherLocal = [grandfathers objectAtIndex:0];
    Son *sonLocal = [grandfatherLocal.sons objectAtIndex:0];

    // Not sure what to do here to get to the "href" eventually
    // This was my best guess...
    Grandson *grandsonLocal = [sonLocal.grandsons objectAtIndex:indexPath.row];
    cell.textLabel.text = [grandsonLocal.links.api.news.href valueForKey:@"href"];

I'm not sure how to get to the nested data at that point. (FYI I set up Models and am using RestKit, so thats the context for what I'm doing here.)

EDIT: I'm getting nothing displayed in the table, and the error in the Output is just: "Could not find an object mapping for keyPath: ''"

EDIT: Grandson Interface per request:

@interface Team : NSObject
@property (nonatomic, strong) NSNumber *id;
@property (nonatomic, strong) Links *links;
+ (RKObjectMapping *) mapping;

EDIT: Alessandro answered my question perfectly, see below. BTW, he went above and beyond to help me, I'm super greatful-



If grandsonLocal is fetched correctly, then I think you should just use

    cell.textLabel.text = grandsonLocal.links.api.news.href;

If this doesn't work, try to put a breakpoint in that line and inspect the content of grandsonLocal and of its properties.

Need Your Help

php preg_match characters

php preg-match character special-characters

I need help with preg_match function in php. I have read a lot of answers on SO, but I can't get any needed information.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.