What I personally do is add a method to all JSONModel instances:
- (ID) mergeWithContext:
Whenever I get a JSON object from the Internet, the JSONModel parses it for me and converts the data to what I need, then if I want to save it to CoreData, I just call mergeWithContext: and pass the current context to it.
Further in my mergeWithContext method: I just create a new object corresponding to the current JSONModel and copy all the values. (In fact, I also check if the object with the model identifier exists in CoreData - then I update it, otherwise I will create a new instance).
Not too complicated, and you get enough flexibility if you need to add some kind of custom behavior when saving data.
mergeWithContext: returns, of course, the object itself, so I can work with it further if I need to.
source share