Reputation: 14039
In my iOS app I've got a server sending me json messages. I decode those json messages and built a custom object from.
Amongst the json data I also get a property of custom objects which get decoded differently by different controllers, so I'd rather keep that information decoded / in raw format and not build a custom class from it.
I wish to save the object and its custom data to a local database using coredata. I'm now contemplating the two alternatives.
With which one should I go? What's the best practice here?
Upvotes: 0
Views: 198
Reputation: 119031
Use a transformable attribute and store the data as either the array or dictionary you unpack from the JSON. It isn't very efficient accessing this attribute directly (you will incur an archiving overhead) so you should add a transient attribute to cache the value after first access.
Upvotes: 1