View Full Version : Importing JSON in SQLite

9 Feb 2012, 7:09 AM

in my last question i had some performance issues parsing a "big" JSON file (200kb).
I now thought about splitting the data and put it in 3 different DB tables.
When the user starts the app for the first time, the data from the JSON files, the tables will be created and the data will be imported. So i have to parse the data only once and not on every start.

I used the sqlite-proxy by tomalex for sencha 1.x (but since the sqlite lite proxy thread hasnt been touched since last year i ask again in this forum).
DB and table creation work fine but how do i import a whole bunch of records into the table?

For example, i have a JSON file like this:

{ "firstname":"Alex",
{ "firstname":"Andy",
<here come 200 more records>

How can i "import" this into a table with the same structure?

thx for helping

9 Feb 2012, 10:56 AM
I wouldn't have such a massive number of records returned. Like if you were to load 200 records into a List it would of course act slow, this is where paging should be used with like 25 records for each page. I also wouldn't load JSON, change it so that a store can consume it, the server should return JSON in the format a Store can consume easily.

9 Feb 2012, 11:05 AM
Hi Mitchell,

thx for your reply.
I want to create an offline app for iphone/android using phonegap.
The data is not coming from a server, it is stored within the app. The app should be a complete offline app.

10 Feb 2012, 5:40 AM

ok this problem is solved. I figured out how to read a flat file and import it into a sqlite database.

What i now need to do is change from the json proxy to the sqlite proxy.
I am still using the oreilly example to get familiar with this.
Any example or hints how you would switch from jsonproxy to sqlite proxy (in the sessionlist.js)?

thx in advance