Code example for JSONObject

Methods: put

0
 
    private void setStatus(int status) {
        this.status = status;
    } 
    private JSONObject getAccelerationJSON() {
        JSONObject r = new JSONObject();
        try { 
            r.put("x", this.x);
            r.put("y", this.y);
            r.put("z", this.z);
            r.put("timestamp", this.timestamp);
        } catch (JSONException e) {
            e.printStackTrace();
        } 
        return r;
    } 
} 
Stop searching for code, let great code find you!  Add Codota to your java IDE