SQL Lite or JSON?

Hello guys.

I am thinking about a potential app and was wondering which way to go. I will need to have a place to put a lot short sentences and randomly pick one up and display it on the screen. I could enter the sentences manually into an excel file and either export the all file into a database using SQL Lite or to JSON. I do not really need bunch of fields (one or two probably will be enough) And I will probably do not need to do any search. That seems to indicate the JSON file is better but it look like SQL is very simple to deal with.

Also anybody knows of an app which either convert an Excel file to Json or a simple app that would allow to build a SQL database either from scratch or by exporting an excel file to it.

Obviously, I will do some research myself but I just wanted to see if people here have some suggestions on which method to use in this case (SQL or JSON)

Thanks a lot!

Mo

ps: A potential future feature maybe putting the database or the JSON file on a server so that the user will get an always updated version of the sentences. I do not know if that would make you decide one way or the other… [import]uid: 100814 topic_id: 30984 reply_id: 330984[/import]

Hi guys.

I found this on the Excel(csv) to Json if anybody is interested:

http://www.cparker15.com/code/utilities/csv-to-json/
Mo
[import]uid: 100814 topic_id: 30984 reply_id: 123879[/import]

I think you should go with Json if you don’t need to do any search. [import]uid: 138389 topic_id: 30984 reply_id: 123888[/import]

Doesn’t really matter. Given you found an excel/csv to json converter that might be easier for you. With either method I would load the data to a table upon app start which would mitigate the advantages to either. [import]uid: 147305 topic_id: 30984 reply_id: 123898[/import]

Thank you guys! Those are good points.

JSON it is then!

Mo

[import]uid: 100814 topic_id: 30984 reply_id: 123901[/import]

JSON is great for table data in particular if you’re going to have the whole table loaded into memory at once. But for very large data sets where you are only interested in one or a few records at a time a database is the way to go, or if you’re making changes to one record of many and have to save that data back out. With JSON you pretty much have to read and write the whole table for each save.

However, I have not quite figured out how to do is how do I pre-populate an SQL table with Corona? If it resides in documents.ResourcesDirectory, then you can’t update it. So it seems to me, even with a large table of data, you will need your read only source in your bundle (where main.lua lives for instance) and then create the database in system.DocumentsDirectory when the app runs for the first time and then populate it from the fixed source. JSON would seem to be a logical source for the fixed data to load into the database. I’m happy this hasn’t been a hurdle I’ve needed to cross yet.

I’ve been good with JSON for everything so far. [import]uid: 19626 topic_id: 30984 reply_id: 123950[/import]

Not sure why but Rob’s comment reminded me but you could also just stick them in a line separated file(each sentence on it’s own line). In some word games I am working on I have some word files with 100k+ lines that i just read into a table. Exceptionally easy, really.

But if you already started with json then I would just stick with it. [import]uid: 147305 topic_id: 30984 reply_id: 123955[/import]

Thanks guys!

Yes Rob I hear you. Since i would not need to change the data file (simply take a random sentence and display it) then I think a JSON (or even as Budersank suggest a simple text file) I just want to have a good way to modify the list of sentence (excel file outside the app) and then simply turn it into a json or text file. I may need later to allow people to “upgrade” the list but i will cross that bridge when i get there!

Thank you so much guys for all the suggestions.

Mo [import]uid: 100814 topic_id: 30984 reply_id: 123985[/import]

Does anybody knows why we cannot (at least i can’t) modify the first post (my original post)? I had this problem before. Peach? I want to make this thread resolved but I can’t for some reason.

Mo [import]uid: 100814 topic_id: 30984 reply_id: 123986[/import]

Hi guys.

I found this on the Excel(csv) to Json if anybody is interested:

http://www.cparker15.com/code/utilities/csv-to-json/
Mo
[import]uid: 100814 topic_id: 30984 reply_id: 123879[/import]

I think you should go with Json if you don’t need to do any search. [import]uid: 138389 topic_id: 30984 reply_id: 123888[/import]

Doesn’t really matter. Given you found an excel/csv to json converter that might be easier for you. With either method I would load the data to a table upon app start which would mitigate the advantages to either. [import]uid: 147305 topic_id: 30984 reply_id: 123898[/import]

Thank you guys! Those are good points.

JSON it is then!

Mo

[import]uid: 100814 topic_id: 30984 reply_id: 123901[/import]

JSON is great for table data in particular if you’re going to have the whole table loaded into memory at once. But for very large data sets where you are only interested in one or a few records at a time a database is the way to go, or if you’re making changes to one record of many and have to save that data back out. With JSON you pretty much have to read and write the whole table for each save.

However, I have not quite figured out how to do is how do I pre-populate an SQL table with Corona? If it resides in documents.ResourcesDirectory, then you can’t update it. So it seems to me, even with a large table of data, you will need your read only source in your bundle (where main.lua lives for instance) and then create the database in system.DocumentsDirectory when the app runs for the first time and then populate it from the fixed source. JSON would seem to be a logical source for the fixed data to load into the database. I’m happy this hasn’t been a hurdle I’ve needed to cross yet.

I’ve been good with JSON for everything so far. [import]uid: 19626 topic_id: 30984 reply_id: 123950[/import]

Not sure why but Rob’s comment reminded me but you could also just stick them in a line separated file(each sentence on it’s own line). In some word games I am working on I have some word files with 100k+ lines that i just read into a table. Exceptionally easy, really.

But if you already started with json then I would just stick with it. [import]uid: 147305 topic_id: 30984 reply_id: 123955[/import]

Thanks guys!

Yes Rob I hear you. Since i would not need to change the data file (simply take a random sentence and display it) then I think a JSON (or even as Budersank suggest a simple text file) I just want to have a good way to modify the list of sentence (excel file outside the app) and then simply turn it into a json or text file. I may need later to allow people to “upgrade” the list but i will cross that bridge when i get there!

Thank you so much guys for all the suggestions.

Mo [import]uid: 100814 topic_id: 30984 reply_id: 123985[/import]

Does anybody knows why we cannot (at least i can’t) modify the first post (my original post)? I had this problem before. Peach? I want to make this thread resolved but I can’t for some reason.

Mo [import]uid: 100814 topic_id: 30984 reply_id: 123986[/import]