2

I've got the following JSON payload:

"user": {
  "id": 1,
  "username": "bla",
  "first_name": "bla",
  "self": {
    "info": "MyInfo",
    "website": "MyWebsite"
  },
  //... some more properties doesn't matter
}

I try to map that nested object self into the user model as well and did the following property mappings:

mapping.addAttributeMappingsFromDictionary(
            ["id"                : "id",
             "username"          : "username",
             "first_name"        : "firstname",
             "self.info"         : "info",
             "self.website"      : "website"])

Now when I trigger a GET - request everything maps fine instead of the nested properties self.info and self.website. When I do a relationship mapping it works as well but I need a separate model which is a bit ugly for these informations.

I'm using RestKit 0.25

dibi
  • 3,257
  • 4
  • 24
  • 31

1 Answers1

0

I just encountered that the problem relies to the method [object valueForKeyPath:] which RestKit uses for its mappings. This method returns the object itself when it gets called with self so when I change the JSON keyPath to something different e.g. personal.info it works as expected! I think this has changed in a recent RestKit release because another app using RestKit 0.23.x works with a self keypath.

dibi
  • 3,257
  • 4
  • 24
  • 31