Example usage for org.json.simple JSONObject put

List of usage examples for org.json.simple JSONObject put

Introduction

In this page you can find the example usage for org.json.simple JSONObject put.

Prototype

V put(K key, V value);

Source Link

Document

Associates the specified value with the specified key in this map (optional operation).

Usage

From source file:JavaCloud.Models.VM.java

public void saveImage() throws CoreException {
    JSONObject object = new JSONObject();
    object.put("token", token);
    object.put("vm_id", id);
    Utils.request(address, "/api/vm/save_image/", object);
}

From source file:JavaCloud.Models.VM.java

public void cancelTasks() throws CoreException {
    JSONObject object = new JSONObject();
    object.put("token", token);
    object.put("vm_id", id);
    Utils.request(address, "/api/vm/cancel_tasks/", object);
}

From source file:alexaactions.SmartThingsTemperatureDevices.java

private String getJson(String value, String units) {
    JSONObject jobj = new JSONObject();

    jobj.put("temp", value);
    jobj.put("units", units);
    return jobj.toJSONString();
}

From source file:com.mobicage.rogerthat.SearchLocation.java

@SuppressWarnings("unchecked")
@Override// ww w . j  a va2s .  c o m
public JSONObject toJSONObject() {
    JSONObject jsonObject = new JSONObject();
    jsonObject.put("address", address);
    jsonObject.put("lat", latitude);
    jsonObject.put("lon", longitude);
    return jsonObject;
}

From source file:io.personium.client.ExtCellManager.java

/**
 * This method is used to create an ExtCell using an ExtCell object.
 * @param obj ExtCell object/*from   w  w  w .jav a2  s.  c  o  m*/
 * @return ExtCell object that is created
 * @throws DaoException Exception thrown
 */
@SuppressWarnings("unchecked")
public ExtCell create(ExtCell obj) throws DaoException {
    JSONObject body = new JSONObject();
    body.put("Url", obj.getUrl());
    JSONObject json = internalCreate(body);
    obj.initialize(this.accessor, json);
    return obj;
}

From source file:JavaCloud.Models.Image.java

public void upload_url(String url) throws CoreException {
    JSONObject object = new JSONObject();
    object.put("token", token);
    object.put("image_id", id);
    object.put("url", url);
    Utils.request(address, "/api/image/upload_url/", object);
}

From source file:JavaCloud.Models.Image.java

public void attach(VM vm) throws CoreException {
    JSONObject object = new JSONObject();
    object.put("token", token);
    object.put("image_id", id);
    object.put("vm_id", vm.id);
    Utils.request(address, "/api/image/attach/", object);
}

From source file:JavaCloud.Models.Image.java

public void detach(VM vm) throws CoreException {
    JSONObject object = new JSONObject();
    object.put("token", token);
    object.put("image_id", id);
    object.put("vm_id", vm.id);
    Utils.request(address, "/api/image/detach/", object);
}

From source file:JavaCloud.Models.Image.java

public void edit(String field, String value) throws CoreException {
    JSONObject object = new JSONObject();
    object.put("token", token);
    object.put("image_id", id);
    object.put(field, value);/*from w  w  w .j a  v a 2 s .  co m*/
    Utils.request(address, "/api/image/edit/", object);
}

From source file:marketDB.del_db.java

@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    Cookie[] cookies = request.getCookies();
    String access_token = "";
    for (int i = 0; i < cookies.length; i++) {
        if (cookies[i].getName().equals("access_token")) {
            access_token = cookies[i].getValue();
        }/*from  ww w. jav a  2s .  co m*/
    }
    String product_id = request.getParameter("product_id");
    int status = 0;

    try {
        status = delProduct(access_token, product_id);
    } catch (IOException_Exception ex) {
        Logger.getLogger(del_db.class.getName()).log(Level.SEVERE, null, ex);
    } catch (ParseException_Exception ex) {
        Logger.getLogger(del_db.class.getName()).log(Level.SEVERE, null, ex);
    }
    if (status == 1) {
        JSONObject arrayObj = new JSONObject();
        arrayObj.put("status", status);
        response.sendRedirect("your_product.jsp");
    } else {
        response.sendRedirect("login.jsp");
    }
}