how do I store a JSON Object in an SQLite database? What is the correct way?
one place is the blob type column. if i can convert the JSON object into byte array and use Fileoutputstream
the other idea is to store in a text column as a String
import org.json.JSONObject; JSONObject jsonObject; public void createJSONObject(Fields fields) { jsonObject = new JSONObject(); try { jsonObject.put("storedValue1", fields.storedValue1); jsonObject.put("storedValue2", fields.storedValue2); jsonObject.put("storedValue3", fields.storedValue3); jsonObject.put("storedValue4", fields.storedValue4); jsonObject.put("storedValue5", fields.storedValue5); jsonObject.put("storedValue6", fields.storedValue6); } catch (JSONException e) { e.printStackTrace(); } }
JSONObject(which is not JSON). That can be done withjsonObject.toString().