jeudi 5 mai 2016

From JSON string that contains arrays to SQLite Android

Im making an app that need to save some sensorvalues to a SQLite database. Im creating a json-string that has the following structure:

{  
   "forceList":[
       0.003,
       0.003,
       0.003,
       0.003,
       0.003,
       0.003,
       0.003,
       0.003,
       0.003,
       0.003
    ],
   "gForceValue":0.0,
   "id":0,
   "latList":[  
      60.66845333333334,
      60.66840666666667,
      60.66838333333333,
      60.66836,
      60.66833833333333,
      60.66831666666667,
      60.66829833333333,
      60.66828,
      60.66826,
      60.66824
   ]
}

and so on... the json string is a bit longer but the structure is the same.

The values that are of interest to me is the ones that are in the lists. How can i put these values into the database? For example, i want a column named Force and the values from forceList in the column, and another column named Latitude with the latlist values in it.

Aucun commentaire:

Enregistrer un commentaire