如何存储一个JSON Object SQLite中的数据库? 正确的方法是什么?
一个地方是blob类型列。 如果我能把" JSON对象转换为字节数组,然后使用Fileoutputstream
另一个办法是在文本栏中储存为Stringimport 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();
}
}