从创建SQLite数据库JSON对象 [英] Creating json objects from sqlite database

查看:327
本文介绍了从创建SQLite数据库JSON对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要创建一个从SQLite数据库JSON对象。并进一步我要存储JSON对象在我的服务器。我想整个表格转换在我的SQLite数据库到JSON对象,这样我的数据不占用我server.Is这可能多少空间?如果是这样,有人可以帮我做这个提供适当的资源?

I need to create JSON OBJECT from sqlite database. And further I want to store that JSON OBJECT in my server. And I want to convert an entire table in my sqlite database to JSON object so that my data doesn't occupy much space in my server.Is this possible?? If so, can someone help me by providing proper resources for doing this?

推荐答案

创建JSON对象从SQLite数据库 - 我想是这样this.What做u在我的SQLite数据库将整个表到JSON对象的意思???

Create JSON OBJECT from sqlite database-I've tried something like this.What do u mean by converting entire table in my sqlite database to Json object???

JSONObject jsonObject = new JSONObject();

ArrayList<DrugDetails> drugDetails = DataInterface
            .getSelectedDrugDetails();//this should be ur db query which returns the arraylist                          
    if (drugDetails != null && drugDetails.size() > 0) {
        JSONArray array = new JSONArray();
        for (DrugDetails selectedDrugDetails : drugDetails) {
            JSONObject json = new JSONObject();
            json.put(APPOINTMENT_ID, ""+"selectedDrugDetails.getAppoinmentID()");
            json.put(DOCUMENT_ID, ""+selectedDrugDetails.getId());
            array.put(json);
        }
        jsonObject.put(COLLATERAL_LIST, array);
    }  

这篇关于从创建SQLite数据库JSON对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆