Example usage for org.json.simple JSONArray JSONArray

List of usage examples for org.json.simple JSONArray JSONArray

Introduction

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

Prototype

JSONArray

Source Link

Usage

From source file:cc.sferalabs.libs.telegram.bot.api.types.ReplyKeyboardMarkup.java

/**
 * @param keyboard//w w  w.  j a v a  2  s.  c o  m
 * @return
 */
@SuppressWarnings("unchecked")
private static JSONArray toJsonArray(String[][] keyboard) {
    JSONArray matrix = new JSONArray();
    for (String[] line : keyboard) {
        JSONArray array = new JSONArray();
        array.addAll(Arrays.asList(line));
        matrix.add(array);
    }
    return matrix;
}

From source file:com.doubotis.restwrapper.data.JArray.java

@Override
public String toJSONString() {

    JSONArray jsonArray = new JSONArray();
    jsonArray.addAll(this);
    return jsonArray.toJSONString();
}

From source file:fi.hsl.parkandride.itest.JSONObjectBuilder.java

public JSONArray asArray() {
    final JSONArray jsonArray = new JSONArray();
    jsonArray.add(jsonObject);
    return jsonArray;
}

From source file:JSON.WriteProductJSON.java

public WriteProductJSON() {
    products = new JSONObject();
    details = new JSONArray();
}

From source file:JSON.WriteQuestionnaireJSON.java

public WriteQuestionnaireJSON() {
    questionnaire = new JSONObject();
    questions = new JSONArray();
}

From source file:com.bigml.histogram.SumResult.java

@SuppressWarnings("unchecked")
public JSONArray toJSON(DecimalFormat format) {
    JSONArray jsonArray = new JSONArray();
    jsonArray.add(Utils.roundNumber(_count, format));
    _targetSum.addJSON(jsonArray, format);
    return jsonArray;
}

From source file:de.ingrid.external.gemet.JSONUtils.java

public static JSONArray toJSONArray(JSONObject jsonObj) {
    JSONArray jsonArray = new JSONArray();
    jsonArray.add(jsonObj);

    return jsonArray;
}

From source file:biz.vnc.zimbra.lighthistoryzimlet.MailhistoryReader.java

public String getRecord(String msgId) {
    JSONObject storejson = new JSONObject();
    JSONArray jsonArray = new JSONArray();
    try {//from www  . ja  v  a2  s.c o  m
        dbConnection = LocalDB.connect(LocalConfig.get().db_name);
        String query = "SELECT * FROM mail_log_internal WHERE message_id=?" + "ORDER BY logtime ASC";
        PreparedStatement statement = dbConnection.prepareStatement(query);
        statement.setString(1, msgId.trim());
        ResultSet resultSet = statement.executeQuery();
        ZLog.info("biz_vnc_lightweight_history", "Read Message Id" + msgId);
        while (resultSet.next()) {
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("logtime", resultSet.getString("logtime"));
            if (resultSet.getString("from_localpart").equals("-")
                    || resultSet.getString("from_domain").equals("-")) {
                jsonObject.put("from", "-");
            } else {
                jsonObject.put("from",
                        resultSet.getString("from_localpart") + "@" + resultSet.getString("from_domain"));
            }
            if (resultSet.getString("to_localpart").equals("-")
                    || resultSet.getString("to_domain").equals("-")) {
                jsonObject.put("to", "-");
            } else {
                jsonObject.put("to",
                        resultSet.getString("to_localpart") + "@" + resultSet.getString("to_domain"));
            }
            jsonObject.put("moveto", resultSet.getString("foldername"));
            jsonObject.put("event", resultSet.getString("event"));
            jsonArray.add(jsonObject);
        }
        storejson.put("list", jsonArray);
    } catch (Exception e) {
        ZLog.err("mail-history", "getRecord: database query failed", e);
    }
    ZLog.info("biz_vnc_lightweight_history", "Recod Json :: " + storejson.toJSONString());
    return storejson.toJSONString();
}

From source file:com.imagelake.android.myuploads.CreateMyUploadthumbnail.java

public CreateMyUploadthumbnail() {
    ja = new JSONArray();

    idi = new ImagesDAOImp();
}

From source file:co.edu.UNal.ArquitecturaDeSoftware.Bienestar.Vista.App.Admin.CUDEventos.java

protected static void iniciarWSC(HttpServletRequest request, HttpServletResponse response) throws IOException {
    ArrayList<UsuarioEntity> usuarios = CtrlAdmin.iniciarWSC(Integer.parseInt(request.getParameter("1")), //id evento
            Integer.parseInt(request.getParameter("2")), //tamao tabla
            Integer.parseInt(request.getParameter("3"))//pagina
    ); // parameter 1: documentoDocente param2: idTaller

    response.setContentType("application/json;charset=UTF-8");
    PrintWriter out = response.getWriter();

    JSONArray list1 = new JSONArray();
    for (UsuarioEntity usuario : usuarios) {
        JSONObject obj = new JSONObject();
        obj.put("id", usuario.getIdUsuario());
        obj.put("titulo", usuario.getNombres() + " " + usuario.getApellidos());
        list1.add(obj);/*from w  w w.  j a v  a  2 s  . co m*/
    }
    out.print(list1);
}