2015-04-30 6 views
0

Je possède ce JSON, et la cartographie im avec manteau:Nested carte objet avec Mantle - Obj-c

{ 
     "comments_count" = 85; 
     "created_at" = "2015/04/30 01:04:01 -0400"; 
     description = "<p>I've set myself a challenge to take something as simple as a potato and make a product page out of it.</p>\n\n<p>Here's the result, you be the judge :)</p>\n\n<p>Check out the full version and get a free potato <a href=\"https://dribbble.com/shots/2042501-Potato/attachments/363345\" rel=\"nofollow\">here</a>.</p>"; 
     height = 600; 
     id = 2042501; 
     "image_url" = "https://d13yacurqjgara.cloudfront.net/users/77760/screenshots/2042501/potato.jpg"; 
     "likes_count" = 769; 
     player =   { 
      id = 77760; 
      "likes_count" = 1358; 
      name = Eldin; 
      "twitter_screen_name" = eldindesign; 
      url = "http://dribbble.com/eldindesign"; 
      username = eldindesign; 
     }; 
     "rebound_source_id" = "<null>"; 
     "rebounds_count" = 0; 
     "short_url" = "http://drbl.in/oBsT"; 
     title = "Potato landing page"; 
     url = "http://dribbble.com/shots/2042501-Potato-landing-page"; 
     "views_count" = 8411; 
    } 

Heres mon mapping:

+ (NSDictionary *)JSONKeyPathsByPropertyKey 
{ 
    // model_property_name : json_field_name 
    return @{ 
      @"title"  : @"title", 
      @"author"  : @"name", 
      @"info"  : @"description", 
      @"views_count" : @"views_count", 
      @"image_url" : @"image_url" 
      }; 
} 

Comment je peux accéder au "nom" propriété, qui est imbriquée dans le dictionnaire "joueur"?

Répondre

1

Réglez simplement @"author" sur @"player.name".