Recommend me the best way to access read-only data

I’m used to using JSON in my iOS apps to read and save user data. I did use SQLite years ago in Mac apps.

In an app I’m starting to work on, I’ve got several ‘databases’ that are read-only and consist of a couple hundred items or less. I’m thinking of just reading the JSON data in each into memory arrays when I need them.

Is there something else I should consider or a better way to handle this? Thanks.

From the sound of it, storing the data in memory should work fine. I would consider parsing the json into a dictionary and make it public. If you need to query the data using different fields or anything that would be easier to do in a database, then that might be a reason to go with SQLite.

1 Like

So I can understand the value of using a dictionary as you don’t have to iterate on an array to find a specific item.

The data are objects, so I guess I can use the name of the object as a key and assign the entire object to a dictionary value and then use variant.objectvalue to assign the object elsewhere?

You must serialize/deserialize objects, that means transforming them as “strings” (to store as a value into a JSON string) and back to objects, if those objects can do that (because some can’t, losing private internal states you can’t read to rebuild them).