3
votes

I have a complex data structure along with some other data fields that used for query that need to save with core data for future use. I am thinking of serialize the complex data structure into JSON string and store as one string field in core data entities instead of create an entity with many properties. This complex data structure is purely saved for future use, there is no query on any properties required, however I do need to query on the other data fields so I am thinking of use core data.

I am wondering is this (store as JSON string) the best practice or there is a better solution for this?

1

1 Answers

3
votes

Short answer, no, that would not be the best solution. If you don't want to store the object with a data model you create then Core Data will give you very little benefit. You'll basically have a bunch of opaque objects that you won't be able to distinguish until you deserialize its json string. If that's sufficient for your needs, then I'd recommend just archiving the objects to disk and skipping the overhead of Core Data.