Question: JSON or SQLite?

Hello Guys,

Just out of curiosity, where is the best to store data? JSON or sqlite?

Im planning on on having a game that has images and questions that I will ask to the user, or course it is random. And have some sort of leader boards with it.

What you guys suggest? JSON or sqlite?

Thanks in advance,

Jam

I would like to know what people think of this as well. . . Any takers on giving your opinion?

Thanks 

James

My small piece of advise.

Small -> medium set of data, with only basic read/write/modify/update use case = JSON

Medium -> large set of data, where you need to read/write/modify/search based on queries = SQLite.

It all depends on your use case really, thats a rough idea though, from someone who has used both a lot.

I’m sure you will get a lot of opinions on this, however :slight_smile:

Great suggestion from @Gremlin. My only addition would be to try and make use of excellent libraries out there that can help you abstract JSON. GGData comes to mind but there are others as well. Best of luck. 

For me, the dividing line is do you need all the data at once or do you need to work with a smaller subset of information at a time?

JSON from a flat file read’s the whole kit-and-kabootle and loads it in to memory.  With an SQL database, you can store many records and find the few that you need to work with at a given time.

SQLite, like any database system has overhead to use.  It’s harder but worth it when you need to work with smaller sets of data from a larger set.  Typically with large data sets, you pay a penalty for having all of it in memory at once.  For small sets of data, the overhead is less to have it all in memory. 

For an app’s settings, JSON/Flat files are the way to go.  Building a complex game where you need to create, read, update and delete records of data, then a Database makes more sense.

Rob

I would like to know what people think of this as well. . . Any takers on giving your opinion?

Thanks 

James

My small piece of advise.

Small -> medium set of data, with only basic read/write/modify/update use case = JSON

Medium -> large set of data, where you need to read/write/modify/search based on queries = SQLite.

It all depends on your use case really, thats a rough idea though, from someone who has used both a lot.

I’m sure you will get a lot of opinions on this, however :slight_smile:

Great suggestion from @Gremlin. My only addition would be to try and make use of excellent libraries out there that can help you abstract JSON. GGData comes to mind but there are others as well. Best of luck. 

For me, the dividing line is do you need all the data at once or do you need to work with a smaller subset of information at a time?

JSON from a flat file read’s the whole kit-and-kabootle and loads it in to memory.  With an SQL database, you can store many records and find the few that you need to work with at a given time.

SQLite, like any database system has overhead to use.  It’s harder but worth it when you need to work with smaller sets of data from a larger set.  Typically with large data sets, you pay a penalty for having all of it in memory at once.  For small sets of data, the overhead is less to have it all in memory. 

For an app’s settings, JSON/Flat files are the way to go.  Building a complex game where you need to create, read, update and delete records of data, then a Database makes more sense.

Rob