Example #1
0
  public KJ_JSONObject getJSONObject(int index) throws KJ_JSONException {
    KJ_JSONValue val = arr.get(index);
    KJ_JSONObject jObj = val.getJSONObject();
    if (jObj == null) throw new KJ_JSONException("Not a JSON Object type");

    return jObj;
  }
Example #2
0
  public String getString(int index) throws KJ_JSONException {
    KJ_JSONValue val = arr.get(index);
    String s = val.getString();
    if (s == null) throw new KJ_JSONException("Not a string type");

    return s;
  }
Example #3
0
  public boolean getBoolean(int index) throws KJ_JSONException {
    KJ_JSONValue val = arr.get(index);
    Boolean b = val.getBoolean();
    if (b == null) throw new KJ_JSONException("Not a boolean type");

    return b;
  }
Example #4
0
  public double getDouble(int index) throws KJ_JSONException {
    KJ_JSONValue val = arr.get(index);
    Double dbl = val.getDouble();
    if (dbl == null) throw new KJ_JSONException("Not a double type");

    return dbl;
  }
Example #5
0
 public String toString() {
   StringBuilder sb = new StringBuilder("").append("[\n");
   for (KJ_JSONValue valItem : arr) {
     sb.append(valItem.toString()).append(",\n");
   }
   if (sb.length() > 2) sb.delete(sb.length() - 2, sb.length() - 1);
   sb.append("]\n");
   return sb.toString();
 }