Package ch.bfh.sokoban.lib.jsonJava

Examples of ch.bfh.sokoban.lib.jsonJava.JSONObject


  /**
   * Add the database options for the php - file to a nameValuePair
   */
  private static void addOptions(Options options)
  {
    jsonObject = new JSONObject();
    jsonArray = new JSONArray();

    try
    {
      jsonObject.put("query", options.getSql());
View Full Code Here


    JSONArray jsonAnswer = new JSONArray();

    try
    {
      // Get the error message
      JSONObject obj = jsonArr.getJSONObject(0);
      lazyAnswer.setError(obj.getBoolean("exceptionFlag"));
      if(lazyAnswer.hasError()) {
        lazyAnswer.setErrorMessage(obj.getString("exceptionText"));
      }

      // Add the insertedId to the array if the user want it
      if(hasInsertedId)
        jsonAnswer.put(new JSONObject().put("insertedId", String.valueOf(obj.getInt("insertId"))));

      for(int i = 1; i < jsonArr.length(); i++)
      {
        obj = jsonArr.getJSONObject(i);
        jsonAnswer.put(obj);
View Full Code Here

   * @return A JSONObject with encrypted keys and values
   */
  public JSONObject jsonObjectEncrypt(JSONObject o) {

    Iterator<?> keys = o.keys();
    JSONObject returnObject = new JSONObject();
    while( keys.hasNext() ){
      String key = (String)keys.next();
      returnObject.put(this.encrypt(key), this.encrypt(o.getString(key)));
    }

    return returnObject;
  }
View Full Code Here

   * @return A JSONObject with decrypted keys and values
   */
  public JSONObject jsonObjectDecrypt(JSONObject o) {

    Iterator<?> keys = o.keys();
    JSONObject returnObject = new JSONObject();
    while( keys.hasNext() ){
      String key = (String)keys.next();

      if(key != null && !key.equals("")) {
        returnObject.put(this.decrypt(key), this.decrypt(o.getString(key)));
      }
    }

    return returnObject;
  }
View Full Code Here

TOP

Related Classes of ch.bfh.sokoban.lib.jsonJava.JSONObject

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.