3

I have the following JSON which I like to map in restkit.

{
 "objects": [
     {"name": "John Doe",
      "contacts": [
         "/url/to/contact/1/",
      ]
     }
}

Is it possible in RestKit to map this directly, combined with Core Data, in which case if the contact with id 1 exists do not follow the url to retrieve the contact. What is the best way to make this work?

swoei
  • 233
  • 1
  • 9
  • 7
    this isn't valid JSON. –  Jan 02 '12 at 15:58
  • It is made with django-tastypie – swoei Jan 03 '12 at 07:53
  • 1
    swoei, the value of contacts is a list of strings. See if you can make it a list of dictionaries. Then, follow [these instructions](https://github.com/RestKit/RestKit/wiki/Object-mapping) to do the mapping. – Flaviu Apr 25 '12 at 18:48

1 Answers1

0

Yes you can, but you should dehydrate your contacts so that you get the id instead of a url, restkit map relationships with id not url. Then follow this post : RestKit Object Mapping Relationships without KVC

Community
  • 1
  • 1
Fred
  • 484
  • 8
  • 16